-
Notifications
You must be signed in to change notification settings - Fork 156
/
setup.py
139 lines (115 loc) · 3.8 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
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')
install_requires = [
'ipython>=5.0.0',
'aiofile>=3.7.4',
'aiohttp>=3.8.4',
'absl-py>=0.1.2',
'google-api-python-client',
'google-auth-httplib2',
'google-auth-oauthlib',
'requests>=2.23.0',
"docker",
"pymongo",
"gdown",
]
if sys.platform != 'darwin':
install_requires.append("htcondor")
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'],
package_dir={
'ganga': 'ganga',
'GangaRelease': 'ganga/GangaRelease'},
packages=pythonPackages,
install_requires=install_requires,
extras_require={
'dev': [
'coverage',
'pytest',
'pytest-cov',
'pytest-pylint',
'pytest-mock'],
'profiler': ['memory_profiler'],
'LHCb': ['LbDevTools'],
'Dirac': ['UltraDict',
'psutil']},
classifiers=[
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11'],
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']},
cmdclass={
'tests': RunTestsCommand,
},
)