-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
109 lines (100 loc) · 3.62 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
#!/usr/bin/env python
# -*- coding: latin-1 -*-
# #
# Copyright 2009-2013 Ghent University
#
# This file is part of hanythingondemand
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (http://www.herculesstichting.be/in_English)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# http://github.com/hpcugent/hanythingondemand
#
# hanythingondemand is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# hanythingondemand is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with hanythingondemand. If not, see <http://www.gnu.org/licenses/>.
# #
"""
Setup for Hanything on Demand
"""
import os
import sys
import subprocess
from os.path import join as mkpath
from setuptools import setup, Command
import hod
def setup_openmpi_libpath():
libpath = os.getenv('LD_LIBRARY_PATH')
os.environ['LD_LIBRARY_PATH'] = '/usr/lib64/openmpi/lib:%s' % libpath
class BaseCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
class TestCommand(BaseCommand):
description = "Run unit tests."
def run(self):
# Cheeky cheeky LD_LIBRARY_PATH hack for Fedora
setup_openmpi_libpath()
ret = subprocess.call(["coverage", "run", "-m", "pytest", "--cov-config=.coveragerc"])
sys.exit(ret)
def find_files(*dirs):
results = []
for src_dir in dirs:
for root, dirs, files in os.walk(src_dir):
results.append((root, map(lambda f: mkpath(root, f), files)))
return results
PACKAGE = {
'name': hod.NAME,
'version': hod.VERSION,
'license': "GPL v2",
'classifiers' : [
'Programming Language :: Python :: 2'
],
'install_requires': [
# stick to latest vsc-base prior to vsc-base 2.6.0
# due to changes in vsc-base 2.6.0 (in the shell_quote function used by GeneralOption.generate_cmd_line),
# single quotes are being wrapped around values in generated job script (e.g. --workdir='$VSC_SCRATCH/hod'),
# which prevents expansion by the shell...
'vsc-base<2.6.0',
'setuptools',
# pin mpi4py to 1.3.1 since it's the last of the 1.x series and we don't want to pick up 2.0.0
# note: mpi4py version is also pinned in tox.ini!
'mpi4py == 1.3.1',
'pbs-python',
'netifaces',
'netaddr',
],
'tests_require': ['tox', 'pytest', 'pytest-cov', 'coverage', 'mock'],
'packages': [
'hod',
'hod.commands',
'hod.config',
'hod.config.autogen',
'hod.config.writer',
'hod.node',
'hod.rmscheduler',
'hod.subcommands',
'hod.work',
],
'data_files': find_files('etc'),
'scripts': ['bin/hod'],
'cmdclass' : {'test': TestCommand},
'long_description': open(os.path.join(os.path.dirname(__file__), 'README.rst')).read(),
'zip_safe': True,
}
if __name__ == '__main__':
setup(**PACKAGE)