forked from piranha/opster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·51 lines (44 loc) · 1.42 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
#!/usr/bin/env python
import sys, os, re
from distutils.core import setup
# Use 2to3 build conversion if required
if sys.version_info >= (3, 0):
from distutils.command.build_py import build_py_2to3 as build_py
else:
from distutils.command.build_py import build_py
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def desc():
info = read('README.rst')
try:
return info + '\n\n' + read('docs/changelog.rst')
except IOError:
# no docs
return info
# grep opster.py since python 3.x cannot import it before using 2to3
opster_text = read('opster.py')
def grep_opsterpy(attrname):
pattern = r"{0}\W*=\W*'([^']+)'".format(attrname)
strval, = re.findall(pattern, opster_text)
return strval
setup(
name='opster',
description='command line parsing speedster',
long_description=desc(),
license='BSD',
version = grep_opsterpy('__version__'),
author = grep_opsterpy('__author__'),
author_email = grep_opsterpy('__email__'),
url='http://github.com/piranha/opster/',
classifiers=[
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development',
],
py_modules=['opster'],
platforms='any',
cmdclass={'build_py':build_py}
)