forked from ganga-devs/ganga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
121 lines (101 loc) · 3.84 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
from setuptools import setup
from setuptools import find_packages
from setuptools import Command
import subprocess
import os
import sys
file_path = os.path.dirname(os.path.realpath(__file__))
_gangaVersion = '8.4.2'
def version():
return _gangaVersion
def readme():
filename = os.path.abspath(os.path.join(file_path, 'README.rst'))
with open(filename) as f:
return f.read()
class RunTestsCommand(Command):
"""
A custom setuptools command to run the Ganga test suite.
"""
description = 'run the Ganga test suite'
all_types = ['unit', 'integration', 'all']
user_options = [
('type=', 't', 'the type of tests: [{0}]'.format(', '.join(all_types))),
('coverage', None, 'should coverage be generated'),
('xunit', None, 'should xunit-compatible files be produced'),
]
def initialize_options(self):
self.type = 'unit'
self.coverage = False
self.xunit = False
def finalize_options(self):
if self.type not in self.all_types:
raise Exception('Test type must be [{0}]'.format(', '.join(self.all_types)))
@staticmethod
def _get_test_env():
ganga_python_dir = os.path.join(file_path, 'ganga')
test_env = os.environ.copy()
path = ':'.join(s for s in [ganga_python_dir, test_env.get('PYTHONPATH', None)] if s)
test_env['PYTHONPATH'] = path
return test_env
def run(self):
cmd = ['py.test']
if self.type in ['unit', 'all']:
cmd.append('ganga/GangaCore/test/Unit')
cmd.append('ganga/GangaCore/Core')
cmd.append('ganga/GangaCore/Runtime')
cmd.append('ganga/GangaCore/Utility')
if self.type in ['integration', 'all']:
cmd.append('ganga/GangaCore/test/GPI')
if self.coverage:
cmd.append('--cov-report xml --cov .')
if self.xunit:
cmd.append('--junitxml tests.xml')
subprocess.check_call(' '.join(cmd), cwd=file_path, shell=True, env=self._get_test_env())
pythonPackages = find_packages('./')
pythonPackages.append('ganga/GangaRelease')
pythonPackages.append('ganga/GangaGUI')
setup(name='ganga',
description='Job management tool',
long_description=readme(),
url='https://github.com/ganga-devs/ganga',
version=version(),
author='Ganga Developers',
author_email='[email protected]',
license='GPL v2',
scripts=['bin/ganga', 'bin/ganga-gui'],
package_dir={'ganga':'ganga', 'GangaRelease':'ganga/GangaRelease', 'GangaGUI':'ganga/GangaGUI'},
packages=pythonPackages,
install_requires=[
'ipython>=5.0.0',
'httplib2>=0.8',
'absl-py>=0.1.2',
'google-api-python-client',
'google-auth-httplib2',
'google-auth-oauthlib',
'requests>=2.23.0',
'Flask>=1.1.2',
'PyJWT~=1.7.1',
'Flask-SQLAlchemy>=2.4.3',
'gunicorn>=20.0.4',
'Flask-Login>=0.5.0',
'Flask-SocketIO==4.3.1',
'SQLAlchemy==1.3.19',
'eventlet>=0.26.1',
"docker",
"pymongo",
"gdown"
],
extras_require={
'dev': ['coverage', 'pytest', 'pytest-cov', 'pytest-pylint', 'pytest-mock'],
'profiler' : ['memory_profiler'],
'LHCb' : ['LbDevTools']},
classifiers=[
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Programming Language :: Python :: 3.6',
],
include_package_data=True,
package_data={'GangaCore': ['Runtime/HEAD_CONFIG.INI'], 'GangaRelease':['ReleaseNotes-*', 'tools/check-new-ganga.py', 'tools/ganga-cvmfs-install.sh', 'tools/ganga-cvmfs-install-dev.sh'], 'GangaGUI':['gui/templates/*.html', 'gui/static/css/main.css', 'gui/static/js/*.js']},
cmdclass={
'tests': RunTestsCommand,
},
)