Completed
Push — master ( e61e99...a0b053 )
by Nicolas
01:23
created

get_install_requires()   A

Complexity

Conditions 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
1
#!/usr/bin/env python
2
3
import glob
4
import os
5
import re
6
import sys
7
from io import open
8
9
from setuptools import setup, Command
10
11
12
if sys.version_info < (2, 7) or (3, 0) <= sys.version_info < (3, 3):
13
    print('Glances requires at least Python 2.7 or 3.3 to run.')
14
    sys.exit(1)
15
16
17
# Global functions
18
##################
19
20
with open(os.path.join('glances', '__init__.py'), encoding='utf-8') as f:
21
    version = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M).group(1)
22
23
if not version:
24
    raise RuntimeError('Cannot find Glances version information.')
25
26
with open('README.rst', encoding='utf-8') as f:
27
    long_description = f.read()
28
29
30
def get_data_files():
31
    data_files = [
32
        ('share/doc/glances', ['AUTHORS', 'COPYING', 'NEWS', 'README.rst',
33
                               'CONTRIBUTING.md', 'conf/glances.conf']),
34
        ('share/man/man1', ['docs/man/glances.1'])
35
    ]
36
37
    return data_files
38
39
40
def get_install_requires():
41
    requires = ['psutil>=2.0.0']
42
    if sys.platform.startswith('win'):
43
        requires.append('bottle')
44
45
    return requires
46
47
48
class tests(Command):
49
    user_options = []
50
51
    def initialize_options(self):
52
        pass
53
54
    def finalize_options(self):
55
        pass
56
57
    def run(self):
58
        import subprocess
59
        import sys
60
        for t in glob.glob('unitest.py'):
61
            ret = subprocess.call([sys.executable, t]) != 0
62
            if ret != 0:
63
                raise SystemExit(ret)
64
        raise SystemExit(0)
65
66
67
# Setup !
68
69
setup(
70
    name='Glances',
71
    version=version,
72
    description="A cross-platform curses-based monitoring tool",
73
    long_description=long_description,
74
    author='Nicolas Hennion',
75
    author_email='[email protected]',
76
    url='https://github.com/nicolargo/glances',
77
    license='LGPLv3',
78
    keywords="cli curses monitoring system",
79
    install_requires=get_install_requires(),
80
    extras_require={
81
        'action': ['pystache'],
82
        'batinfo': ['batinfo'],
83
        'browser': ['zeroconf>=0.17'],
84
        'cpuinfo': ['py-cpuinfo'],
85
        'chart': ['matplotlib'],
86
        'docker': ['docker>=2.0.0'],
87
        'export': ['bernhard', 'cassandra-driver', 'couchdb', 'elasticsearch',
88
                   'influxdb>=1.0.0', 'pika', 'potsdb', 'pyzmq', 'statsd'],
89
        'folders:python_version<"3.5"': ['scandir'],
90
        'gpu': ['nvidia-ml-py'],
91
        'ip': ['netifaces'],
92
        'raid': ['pymdstat'],
93
        'snmp': ['pysnmp'],
94
        'web': ['bottle', 'requests'],
95
        'wifi': ['wifi']
96
    },
97
    packages=['glances'],
98
    include_package_data=True,
99
    data_files=get_data_files(),
100
    cmdclass={'test': tests},
101
    test_suite="unitest.py",
102
    entry_points={"console_scripts": ["glances=glances:main"]},
103
    classifiers=[
104
        'Development Status :: 5 - Production/Stable',
105
        'Environment :: Console :: Curses',
106
        'Environment :: Web Environment',
107
        'Framework :: Bottle',
108
        'Intended Audience :: Developers',
109
        'Intended Audience :: End Users/Desktop',
110
        'Intended Audience :: System Administrators',
111
        'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
112
        'Operating System :: OS Independent',
113
        'Programming Language :: Python :: 2',
114
        'Programming Language :: Python :: 2.7',
115
        'Programming Language :: Python :: 3',
116
        'Programming Language :: Python :: 3.3',
117
        'Programming Language :: Python :: 3.4',
118
        'Programming Language :: Python :: 3.5',
119
        'Programming Language :: Python :: 3.6',
120
        'Topic :: System :: Monitoring'
121
    ]
122
)
123