forked from citeproc-py/citeproc-py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
93 lines (81 loc) · 3.01 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
#!/bin/env python
"""
Setup script for citeproc-py
"""
import os
import sys
from datetime import datetime
from distutils.core import setup
from pkgutil import walk_packages
from subprocess import Popen, PIPE
PACKAGE = 'citeproc'
PACKAGE_ABSPATH = os.path.abspath(PACKAGE)
VERSION_FILE = PACKAGE + '/version.py'
# retrieve the version number from git or VERSION_FILE
# inspired by http://dcreager.net/2010/02/10/setuptools-git-version-numbers/
try:
print('Attempting to get version number from git...')
git = Popen(['git', 'describe', '--abbrev=4', '--dirty'],
stdout=PIPE, stderr=sys.stderr)
if git.wait() != 0:
raise OSError
line = git.stdout.readlines()[0]
__version__ = line.strip()[1:].decode('ascii')
__release_date__ = datetime.now().strftime('%b %d %Y, %H:%M:%S')
with open(VERSION_FILE, 'w') as version_file:
version_file.write("__version__ = '{}'\n".format(__version__))
version_file.write("__release_date__ = '{}'\n".format(__release_date__))
except OSError as e:
print('Assume we are running from a source distribution.')
# read version from VERSION_FILE
with open(VERSION_FILE) as version_file:
code = compile(version_file.read(), VERSION_FILE, 'exec')
exec(code)
with open('README.rst') as file:
README = file.read()
def find_packages(path, prefix):
yield prefix
prefix = prefix + "."
for _, name, ispkg in walk_packages(path, prefix):
if ispkg:
yield name
setup(
name='citeproc-py',
version=__version__,
packages=list(find_packages([PACKAGE_ABSPATH], PACKAGE)),
package_data={PACKAGE: ['data/locales/*.xml',
'data/schema/*.rng']},
scripts=['bin/csl_unsorted'],
requires=['lxml'],
provides=[PACKAGE],
#test_suite='nose.collector',
author='Brecht Machiels',
author_email='brecht@mos6581.org',
description='Citations and bibliograpy formatter',
long_description=README,
url='https://github.com/brechtm/citeproc-py',
keywords='csl citation html rst bibtex xml',
license='2-clause BSD License',
classifiers = [
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Environment :: Other Environment',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Legal Industry',
'Intended Audience :: Other Audience',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Documentation',
'Topic :: Printing',
'Topic :: Software Development :: Documentation',
'Topic :: Software Development :: Libraries :: Python Modules',
]
)