setup.py 2.44 KB
Newer Older
1
import glob
2
import io
3
import os
4
import shutil
echel0n's avatar
echel0n committed
5

6
from setuptools import setup, Command
7

echel0n's avatar
echel0n committed
8
# Get the version number
echel0n's avatar
echel0n committed
9
with io.open(os.path.abspath(os.path.join(os.path.dirname(__file__), 'sickrage', 'version.txt'))) as f:
echel0n's avatar
echel0n committed
10 11
    version = f.read()

12

echel0n's avatar
echel0n committed
13
def requires():
14
    with io.open(os.path.abspath(os.path.join(os.path.dirname(__file__), 'requirements.txt'))) as f:
echel0n's avatar
echel0n committed
15 16 17
        return f.read().splitlines()


18 19 20
class CleanCommand(Command):
    """Custom clean command to tidy up the project root."""
    user_options = []
21

22 23
    def initialize_options(self):
        pass
24

25 26
    def finalize_options(self):
        pass
27

28
    def run(self):
echel0n's avatar
echel0n committed
29 30 31 32
        shutil.rmtree(os.path.abspath(os.path.join(os.path.dirname(__file__), 'build')), ignore_errors=True)
        shutil.rmtree(os.path.abspath(os.path.join(os.path.dirname(__file__), '*.pyc')), ignore_errors=True)
        shutil.rmtree(os.path.abspath(os.path.join(os.path.dirname(__file__), '*.tgz')), ignore_errors=True)
        shutil.rmtree(os.path.abspath(os.path.join(os.path.dirname(__file__), 'sickrage.egg-info')), ignore_errors=True)
33
        [os.remove(f) for f in glob.glob("dist/sickrage-*")]
34

35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

cmd_class = {'clean': CleanCommand}

# Check for Babel availability
try:
    from babel.messages.frontend import compile_catalog, extract_messages, init_catalog, update_catalog

    cmd_class.update(dict(
        compile_catalog=compile_catalog,
        extract_messages=extract_messages,
        init_catalog=init_catalog,
        update_catalog=update_catalog
    ))
except ImportError:
    pass

51
setup(
52 53 54 55
    name='sickrage',
    version=version,
    description='Automatic Video Library Manager for TV Shows',
    author='echel0n',
56
    author_email='[email protected]',
57
    license='GPLv3',
58 59
    url='https://git.sickrage.ca',
    keywords=['sickrage', 'sickragetv', 'tv', 'torrent', 'nzb', 'video', 'echel0n'],
60
    packages=['sickrage'],
echel0n's avatar
echel0n committed
61
    install_requires=requires(),
62 63 64 65
    include_package_data=True,
    platforms='any',
    zip_safe=False,
    test_suite='tests',
66
    cmdclass=cmd_class,
67 68
    entry_points={
        "console_scripts": [
69
            "sickrage=sickrage:main"
70
        ]
71 72
    },
    message_extractors={
echel0n's avatar
echel0n committed
73
        'sickrage/core/webserver': [
74 75 76 77 78
            ('**/views/**.mako', 'mako', {'input_encoding': 'utf-8'})
        ],
        'sickrage': [
            ('**.py', 'python', None)
        ],
79
        'src': [
80 81 82
            ('**/js/*.min.js', 'ignore', None),
            ('**/js/*.js', 'javascript', {'input_encoding': 'utf-8'})
        ],
83
    }
84
)