forked from rgbkrk/bookstore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
79 lines (65 loc) · 2.18 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# Backwards compatibility for Python 2.x
try:
from itertools import ifilter
filter = ifilter
except ImportError:
pass
def get_version():
'''
Version slurping without importing bookstore, since dependencies may not be
met until setup is run.
'''
version_regex = re.compile(r"__version__\s+=\s+"
r"['\"](\d+.\d+.\d+\w*)['\"]$")
versions = filter(version_regex.match, open("bookstore/__init__.py"))
try:
version = next(versions)
except StopIteration:
raise Exception("Bookstore version not set")
return version_regex.match(version).group(1)
version = get_version()
# Utility for publishing the bookstore, courtesy kennethreitz/requests
if sys.argv[-1] == 'publish':
print("Publishing bookstore {version}".format(version=version))
os.system('python setup.py sdist upload')
sys.exit()
packages = ['bookstore']
requires = []
with open('requirements.txt') as reqs:
requires = reqs.read().splitlines()
setup(name='bookstore',
version=version,
description='IPython notebook storage on OpenStack Swift + Rackspace.',
long_description=open('README.rst').read(),
author='Kyle Kelley',
author_email='rgbkrk@gmail.com',
url='http://github.com/rgbkrk/bookstore',
packages=packages,
package_data={'': ['LICENSE']},
include_package_data=False,
install_requires=requires,
license=open('LICENSE').read(),
zip_safe=False,
classifiers=(
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Framework :: IPython',
'Environment :: OpenStack',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: System :: Distributed Computing',
),
)