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

5
from setuptools import setup, Command
6

7 8 9 10

def version():
    with open(os.path.abspath(os.path.join(os.path.dirname(__file__), 'sickrage', 'version.txt'))) as f:
        return f.read()
echel0n's avatar
echel0n committed
11

12

13
def requirements():
14
    with 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 21 22
def requirements_dev():
    with open(os.path.abspath(os.path.join(os.path.dirname(__file__), 'requirements-dev.txt'))) as f:
        return f.read().splitlines()


23 24 25
class CleanCommand(Command):
    """Custom clean command to tidy up the project root."""
    user_options = []
26

27 28
    def initialize_options(self):
        pass
29

30 31
    def finalize_options(self):
        pass
32

33
    def run(self):
echel0n's avatar
echel0n committed
34 35 36 37
        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)
38
        [os.remove(f) for f in glob.glob("dist/sickrage-*")]
39

40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

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

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