1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# This file is part of beets.
5# Copyright 2016, Adrian Sampson.
6#
7# Permission is hereby granted, free of charge, to any person obtaining
8# a copy of this software and associated documentation files (the
9# "Software"), to deal in the Software without restriction, including
10# without limitation the rights to use, copy, modify, merge, publish,
11# distribute, sublicense, and/or sell copies of the Software, and to
12# permit persons to whom the Software is furnished to do so, subject to
13# the following conditions:
14#
15# The above copyright notice and this permission notice shall be
16# included in all copies or substantial portions of the Software.
17
18from __future__ import division, absolute_import, print_function
19
20import os
21import sys
22import subprocess
23import shutil
24from setuptools import setup
25
26
27def _read(fn):
28    path = os.path.join(os.path.dirname(__file__), fn)
29    return open(path).read()
30
31
32def build_manpages():
33    # Go into the docs directory and build the manpage.
34    docdir = os.path.join(os.path.dirname(__file__), 'docs')
35    curdir = os.getcwd()
36    os.chdir(docdir)
37    try:
38        subprocess.check_call(['make', 'man'])
39    except OSError:
40        print("Could not build manpages (make man failed)!", file=sys.stderr)
41        return
42    finally:
43        os.chdir(curdir)
44
45    # Copy resulting manpages.
46    mandir = os.path.join(os.path.dirname(__file__), 'man')
47    if os.path.exists(mandir):
48        shutil.rmtree(mandir)
49    shutil.copytree(os.path.join(docdir, '_build', 'man'), mandir)
50
51
52# Build manpages if we're making a source distribution tarball.
53if 'sdist' in sys.argv:
54    build_manpages()
55
56
57setup(
58    name='beets',
59    version='1.4.9',
60    description='music tagger and library organizer',
61    author='Adrian Sampson',
62    author_email='adrian@radbox.org',
63    url='http://beets.io/',
64    license='MIT',
65    platforms='ALL',
66    long_description=_read('README.rst'),
67    test_suite='test.testall.suite',
68    include_package_data=True,  # Install plugin resources.
69
70    packages=[
71        'beets',
72        'beets.ui',
73        'beets.autotag',
74        'beets.util',
75        'beets.dbcore',
76        'beetsplug',
77        'beetsplug.bpd',
78        'beetsplug.web',
79        'beetsplug.lastgenre',
80        'beetsplug.metasync',
81    ],
82    entry_points={
83        'console_scripts': [
84            'beet = beets.ui:main',
85        ],
86    },
87
88    install_requires=[
89        'six>=1.9',
90        'mutagen>=1.33',
91        'unidecode',
92        'musicbrainzngs>=0.4',
93        'pyyaml',
94    ] + [
95        # Avoid a version of munkres incompatible with Python 3.
96        'munkres~=1.0.0' if sys.version_info < (3, 5, 0) else
97        'munkres!=1.1.0,!=1.1.1' if sys.version_info < (3, 6, 0) else
98        'munkres>=1.0.0',
99    ] + (
100        # Use the backport of Python 3.4's `enum` module.
101        ['enum34>=1.0.4'] if sys.version_info < (3, 4, 0) else []
102    ) + (
103        # Pin a Python 2-compatible version of Jellyfish.
104        ['jellyfish==0.6.0'] if sys.version_info < (3, 4, 0) else ['jellyfish']
105    ) + (
106        # Support for ANSI console colors on Windows.
107        ['colorama'] if (sys.platform == 'win32') else []
108    ),
109
110    tests_require=[
111        'beautifulsoup4',
112        'flask',
113        'mock',
114        'pylast',
115        'rarfile',
116        'responses',
117        'pyxdg',
118        'python-mpd2',
119        'discogs-client'
120    ] + (
121        # Tests for the thumbnails plugin need pathlib on Python 2 too.
122        ['pathlib'] if (sys.version_info < (3, 4, 0)) else []
123    ),
124
125    # Plugin (optional) dependencies:
126    extras_require={
127        'absubmit': ['requests'],
128        'fetchart': ['requests', 'Pillow'],
129        'embedart': ['Pillow'],
130        'embyupdate': ['requests'],
131        'chroma': ['pyacoustid'],
132        'gmusic': ['gmusicapi'],
133        'discogs': ['discogs-client>=2.2.1'],
134        'beatport': ['requests-oauthlib>=0.6.1'],
135        'kodiupdate': ['requests'],
136        'lastgenre': ['pylast'],
137        'lastimport': ['pylast'],
138        'lyrics': ['requests', 'beautifulsoup4', 'langdetect'],
139        'mpdstats': ['python-mpd2>=0.4.2'],
140        'plexupdate': ['requests'],
141        'web': ['flask', 'flask-cors'],
142        'import': ['rarfile'],
143        'thumbnails': ['pyxdg', 'Pillow'] +
144        (['pathlib'] if (sys.version_info < (3, 4, 0)) else []),
145        'metasync': ['dbus-python'],
146        'sonosupdate': ['soco'],
147        'bpd': ['PyGObject'],
148        'replaygain': ['PyGObject'],
149    },
150    # Non-Python/non-PyPI plugin dependencies:
151    #   chroma: chromaprint or fpcalc
152    #   convert: ffmpeg
153    #   badfiles: mp3val and flac
154    #   bpd: python-gi and GStreamer 1.0+
155    #   embedart: ImageMagick
156    #   absubmit: extractor binary from http://acousticbrainz.org/download
157    #   keyfinder: KeyFinder
158    #   replaygain: python-gi and GStreamer 1.0+ or mp3gain/aacgain
159    #               or Python Audio Tools
160    #   ipfs: go-ipfs
161
162    classifiers=[
163        'Topic :: Multimedia :: Sound/Audio',
164        'Topic :: Multimedia :: Sound/Audio :: Players :: MP3',
165        'License :: OSI Approved :: MIT License',
166        'Environment :: Console',
167        'Environment :: Web Environment',
168        'Programming Language :: Python',
169        'Programming Language :: Python :: 2',
170        'Programming Language :: Python :: 2.7',
171        'Programming Language :: Python :: 3',
172        'Programming Language :: Python :: 3.4',
173        'Programming Language :: Python :: 3.5',
174        'Programming Language :: Python :: 3.6',
175        'Programming Language :: Python :: 3.7',
176        'Programming Language :: Python :: 3.8',
177        'Programming Language :: Python :: Implementation :: CPython',
178    ],
179)
180