|
1 | 1 | #!/usr/bin/env python
|
2 | 2 |
|
| 3 | +# Installation script for diffpy.srmise |
| 4 | + |
| 5 | +"""diffpy.srmise - identify peaks and peak shoulders in PDF curve |
| 6 | +
|
| 7 | +Packages: diffpy.srmise |
| 8 | +""" |
| 9 | + |
| 10 | +import os |
3 | 11 | from setuptools import setup, find_packages
|
4 |
| -setup( |
| 12 | + |
| 13 | +# versioncfgfile holds version data for git commit hash and date. |
| 14 | +# It must reside in the same directory as version.py. |
| 15 | +MYDIR = os.path.dirname(os.path.abspath(__file__)) |
| 16 | +versioncfgfile = os.path.join(MYDIR, 'diffpy/srmise/version.cfg') |
| 17 | + |
| 18 | +def gitinfo(): |
| 19 | + from subprocess import Popen, PIPE |
| 20 | + kw = dict(stdout=PIPE, cwd=MYDIR) |
| 21 | + proc = Popen(['git', 'describe', '--match=v[[:digit:]]*'], **kw) |
| 22 | + desc = proc.stdout.read() |
| 23 | + proc = Popen(['git', 'log', '-1', '--format=%H %at %ai'], **kw) |
| 24 | + glog = proc.stdout.read() |
| 25 | + rv = {} |
| 26 | + rv['version'] = '-'.join(desc.strip().split('-')[:2]).lstrip('v') |
| 27 | + rv['commit'], rv['timestamp'], rv['date'] = glog.strip().split(None, 2) |
| 28 | + return rv |
| 29 | + |
| 30 | + |
| 31 | +def getversioncfg(): |
| 32 | + from ConfigParser import SafeConfigParser |
| 33 | + cp = SafeConfigParser() |
| 34 | + cp.read(versioncfgfile) |
| 35 | + gitdir = os.path.join(MYDIR, '.git') |
| 36 | + if not os.path.isdir(gitdir): return cp |
| 37 | + try: |
| 38 | + g = gitinfo() |
| 39 | + except OSError: |
| 40 | + return cp |
| 41 | + d = cp.defaults() |
| 42 | + if g['version'] != d.get('version') or g['commit'] != d.get('commit'): |
| 43 | + cp.set('DEFAULT', 'version', g['version']) |
| 44 | + cp.set('DEFAULT', 'commit', g['commit']) |
| 45 | + cp.set('DEFAULT', 'date', g['date']) |
| 46 | + cp.set('DEFAULT', 'timestamp', g['timestamp']) |
| 47 | + cp.write(open(versioncfgfile, 'w')) |
| 48 | + return cp |
| 49 | + |
| 50 | +versiondata = getversioncfg() |
| 51 | + |
| 52 | +# define distribution, but make this module importable |
| 53 | +setup_args = dict( |
5 | 54 | name = "diffpy.srmise",
|
6 |
| - version = "0.4a1", |
| 55 | + version = versiondata.get('DEFAULT', 'version'), |
7 | 56 | namespace_packages = ['diffpy'],
|
8 | 57 | packages = find_packages(),
|
9 | 58 | include_package_data = True,
|
|
23 | 72 | 'srmiseplot = diffpy.srmise.applications.plot:main',
|
24 | 73 | ]
|
25 | 74 | },
|
| 75 | + |
| 76 | + author = "Luke Granlund", |
| 77 | + author_email = "[email protected]", |
| 78 | + description = "SrMise - FIXME", |
| 79 | + license = 'FIXME', |
| 80 | + # url = "", |
| 81 | + # keywords = "", |
| 82 | + classifiers = [ |
| 83 | + # List of possible values at |
| 84 | + # http://pypi.python.org/pypi?:action=list_classifiers |
| 85 | + 'Development Status :: 3 - Alpha', |
| 86 | + 'Environment :: Console', |
| 87 | + 'Intended Audience :: Developers', |
| 88 | + 'Intended Audience :: Education', |
| 89 | + 'Intended Audience :: Science/Research', |
| 90 | + 'License :: OSI Approved :: BSD License', |
| 91 | + 'Operating System :: MacOS', |
| 92 | + 'Operating System :: POSIX', |
| 93 | + 'Programming Language :: Python :: 2.6', |
| 94 | + 'Programming Language :: Python :: 2.7', |
| 95 | + 'Topic :: Scientific/Engineering :: Chemistry', |
| 96 | + 'Topic :: Scientific/Engineering :: Physics', |
| 97 | + 'Topic :: Software Development :: Libraries', |
| 98 | + ], |
26 | 99 | )
|
| 100 | + |
| 101 | +if __name__ == '__main__': |
| 102 | + setup(**setup_args) |
0 commit comments