-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
137 lines (106 loc) · 4.83 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
__author__ = "Pradeep Mantha"
__copyright__ = "Copyright 2011, RADICAL Research, Rutgers University"
__license__ = "MIT"
""" Setup script. Used by easy_install and pip. """
import os
import sys
import subprocess
from setuptools import setup, find_packages, Command
#-----------------------------------------------------------------------------
#
# versioning mechanism:
#
# - short_version: 1.2.3 - is used for installation
# - long_version: v1.2.3-9-g0684b06 - is used as runtime (ru.version)
# - both are derived from the last git tag
# - the file pmr/VERSION is created with the long_version, und used
# by ru.__init__.py to provide the runtime version information.
#
def get_version():
short_version = None # 0.4.0
long_version = None # 0.4.0-9-g0684b06
try:
import subprocess as sp
import re
srcroot = os.path.dirname (os.path.abspath (__file__))
VERSION_MATCH = re.compile (r'(([\d\.]+)\D.*)')
# attempt to get version information from git
p = sp.Popen ('cd %s && git describe --tags --always' % srcroot,
stdout=sp.PIPE, stderr=sp.STDOUT, shell=True)
out = p.communicate()[0]
if p.returncode != 0 or not out :
# the git check failed -- its likely that we are called from
# a tarball, so use ./VERSION instead
out=open ("%s/VERSION" % srcroot, 'r').read().strip()
# from the full string, extract short and long versions
v = VERSION_MATCH.search (out)
if v:
long_version = v.groups ()[0]
short_version = v.groups ()[1]
# sanity check if we got *something*
if not short_version or not long_version :
sys.stderr.write ("Cannot determine version from git or ./VERSION\n")
import sys
sys.exit (-1)
# make sure the version files exist for the runtime version inspection
open ( '%s/VERSION' % srcroot, 'w').write (long_version+"\n")
open ('%s/src/pmr/VERSION' % srcroot, 'w').write (long_version+"\n")
except Exception as e :
print 'Could not extract/set version: %s' % e
import sys
sys.exit (-1)
return short_version, long_version
short_version, long_version = get_version ()
#-----------------------------------------------------------------------------
# check python version. we need > 2.5, <3.x
if sys.hexversion < 0x02070000 or sys.hexversion >= 0x03000000:
raise RuntimeError("Pilot-MapReduce requires Python 2.x (2.7 or higher)")
#-----------------------------------------------------------------------------
#
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
#-----------------------------------------------------------------------------
setup_args = {
'name' : 'Pilot-MapReduce',
'version' : short_version,
'description' : "A Pilot-based MapReduce framework",
#'long_description' : (read('README.md') + '\n\n' + read('CHANGES.md')),
'author' : 'RADICAL Group at Rutgers University',
'author_email' : '[email protected]',
'maintainer' : "Pradeep Mantha",
'maintainer_email' : '[email protected]',
'url' : 'https://github.com/saga-project/PilotMapReduce',
'license' : 'MIT',
'keywords' : "radical pilot MapReduce saga",
'classifiers' : [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Environment :: Console',
'License :: OSI Approved :: MIT',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Utilities',
'Topic :: System :: Distributed Computing',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Operating System :: Unix',
],
'packages' : find_packages('src'),
'package_dir' : {'': 'src'},
'py_modules' : ['cluster.yarn.setup','cluster.yarn.stop',
'cluster.hadoop.setup','cluster.hadoop.stop',
'cluster.spark.setup','cluster.spark.stop'],
'package_data' : {'': ['*.sh', 'VERSION', ]},
'install_requires' : ['setuptools',
'bigjob',
'radical.utils'],
#'tests_require' : ['setuptools', 'nose'],
#'test_suite' : 'sagapilot.tests',
'zip_safe' : False,
}
#-----------------------------------------------------------------------------
setup (**setup_args)
#-----------------------------------------------------------------------------