forked from diffpy/diffpy.srmise
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·103 lines (89 loc) · 3.35 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
#!/usr/bin/env python
# Installation script for diffpy.srmise
"""diffpy.srmise - Peak extraction/fitting tool for pair distribution functions
Packages: diffpy.srmise
"""
import os
from setuptools import setup, find_packages
# versioncfgfile holds version data for git commit hash and date.
# It must reside in the same directory as version.py.
MYDIR = os.path.dirname(os.path.abspath(__file__))
versioncfgfile = os.path.join(MYDIR, 'diffpy/srmise/version.cfg')
def gitinfo():
from subprocess import Popen, PIPE
kw = dict(stdout=PIPE, cwd=MYDIR)
proc = Popen(['git', 'describe', '--match=v[[:digit:]]*'], **kw)
desc = proc.stdout.read()
proc = Popen(['git', 'log', '-1', '--format=%H %at %ai'], **kw)
glog = proc.stdout.read()
rv = {}
rv['version'] = '-'.join(desc.strip().split('-')[:2]).lstrip('v')
rv['commit'], rv['timestamp'], rv['date'] = glog.strip().split(None, 2)
return rv
def getversioncfg():
from ConfigParser import SafeConfigParser
cp = SafeConfigParser()
cp.read(versioncfgfile)
gitdir = os.path.join(MYDIR, '.git')
if not os.path.isdir(gitdir): return cp
try:
g = gitinfo()
except OSError:
return cp
d = cp.defaults()
if g['version'] != d.get('version') or g['commit'] != d.get('commit'):
cp.set('DEFAULT', 'version', g['version'])
cp.set('DEFAULT', 'commit', g['commit'])
cp.set('DEFAULT', 'date', g['date'])
cp.set('DEFAULT', 'timestamp', g['timestamp'])
cp.write(open(versioncfgfile, 'w'))
return cp
versiondata = getversioncfg()
# define distribution, but make this module importable
setup_args = dict(
name = "diffpy.srmise",
version = versiondata.get('DEFAULT', 'version'),
namespace_packages = ['diffpy'],
packages = find_packages(),
include_package_data = True,
zip_safe = False,
# Dependencies
# numpy
# scipy
# matplotlib >= 1.1.0
install_requires = ['matplotlib >= 1.1.0', 'numpy', 'scipy'],
# other arguments here...
entry_points = {
'console_scripts' : [
'srmise = diffpy.srmise.applications.extract:main',
'srmiseplot = diffpy.srmise.applications.plot:main',
]
},
author = "Luke Granlund",
author_email = "luke.r.granlund@gmail.com",
description = ("Peak extraction and peak fitting tool for atomic "
"pair distribution functions."),
license = 'BSD-style license',
url = "https://github.com/diffpy/diffpy.srmise/",
keywords = "peak extraction fitting PDF AIC multimodeling",
classifiers = [
# List of possible values at
# http://pypi.python.org/pypi?:action=list_classifiers
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: MacOS',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Scientific/Engineering :: Chemistry',
'Topic :: Scientific/Engineering :: Physics',
'Topic :: Software Development :: Libraries',
],
)
if __name__ == '__main__':
setup(**setup_args)