-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
138 lines (118 loc) · 4.51 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
#!/usr/bin/env python
# encoding: utf-8
"""Setup for radical.agent package
"""
__author__ = "Ole Weidner"
__copyright__ = "Copyright 2013, Ole Weidner"
__email__ = "ole.weidner@icloud.com"
__license__ = "MIT"
import os, sys
from distutils.command.install_data import install_data
from distutils.command.sdist import sdist
from setuptools import setup, find_packages
#-----------------------------------------------------------------------------
# figure out the current version
def update_version():
"""
Updates the version based on git tags
"""
version = 'latest'
try:
cwd = os.path.dirname(os.path.abspath(__file__))
fn = os.path.join(cwd, 'src/radical/agent/VERSION')
version = open(fn).read().strip()
except IOError:
from subprocess import Popen, PIPE, STDOUT
import re
VERSION_MATCH = re.compile(r'\d+\.\d+\.\d+(\w|-)*')
try:
p = Popen(['git', 'describe', '--tags', '--always'],
stdout=PIPE, stderr=STDOUT)
out = p.communicate()[0]
if (not p.returncode) and out:
v = VERSION_MATCH.search(out)
if v:
version = v.group()
except OSError:
pass
return version
#-----------------------------------------------------------------------------
# check python version. we need > 2.5
if sys.hexversion < 0x02050000:
raise RuntimeError("Rhythmos.agent requires Python 2.5 or better")
#-----------------------------------------------------------------------------
#
class radical_agent_install_data(install_data):
"""
Defines the installation install_data
"""
def finalize_options(self):
self.set_undefined_options('install',
('install_lib', 'install_dir'))
install_data.finalize_options(self)
def run(self):
install_data.run(self)
# ensure there's a saga/VERSION file
fn = os.path.join(self.install_dir, 'src/radical/agent/', 'VERSION')
open(fn, 'w').write(update_version())
self.outfiles.append(fn)
#-----------------------------------------------------------------------------
#
class radical_agent_sdist(sdist):
def make_release_tree(self, base_dir, files):
sdist.make_release_tree(self, base_dir, files)
fn = os.path.join(base_dir, 'src/radical/agent/', 'VERSION')
open(fn, 'w').write(update_version())
#-----------------------------------------------------------------------------
#
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
#-----------------------------------------------------------------------------
#
setup(name='radical.agent',
version=update_version(),
author='Ole Weidner',
author_email='ole.weidner@rutgers.edy',
description="Pilot agent for the Rhythmos framework",
long_description=(read('README.md') + '\n\n' + read('CHANGES.md')),
license='MIT',
keywords="radical agent",
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Natural Language :: English',
'Operating System :: OS Independent',
'Topic :: Internet :: WWW/HTTP',
'Framework :: Rhythmos'],
url='https://github.com/oweidner/radical.agent',
packages=find_packages('src'),
package_dir = {'': 'src'},
namespace_packages=['radical'],
scripts=['bin/radical-agent',
'bin/radical-node-monitor',
'bin/radical-process-wrapper'],
#dependency_links=['https://github.com/oweidner/radical.common/zipball/master#egg=radical.common'],
install_requires=['setuptools',
'radical.utils',
'psutil',
'colorama',
'python-hostlist'
#'radical.common'
],
#extras_require=dict(
#test=['zope.testing >= 3.8']),
test_suite = 'radical.agent.tests',
package_data = {'': ['*.sh']},
include_package_data = True,
zip_safe = False,
cmdclass = {
'install_data': radical_agent_install_data,
'sdist': radical_agent_sdist
},
)