This repository has been archived by the owner on Oct 21, 2022. It is now read-only.
forked from concentricsky/badgr-server
-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup.py
82 lines (66 loc) · 2.82 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
import os
import re
from setuptools import find_packages, setup
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# execute version.py in the local namespace, but dont import the module.
exec(compile(open(os.path.join(os.path.dirname(__file__), 'apps/mainsite/version.py'), "rb").read(), os.path.join(os.path.dirname(__file__), 'apps/mainsite/version.py'), 'exec'))
version = ".".join(map(str, VERSION))
def _clean_version_tag(tag):
matches = re.match(r'^v(?P<version>.+)$', tag)
if matches:
return tag[1:]
return tag
def dependencies_from_requirements(requirements_filename):
install_requires = []
dependency_links = []
with open(requirements_filename) as fh:
for line in fh.read().split("\n"):
line = line.strip()
if len(line) < 1 or line.startswith('#') or line.startswith('--'):
continue
matches = re.match(r'git\+(?P<path>.+/)(?P<package_name>.+)\.git@(?P<version>.+)$', line)
if matches:
d = matches.groupdict()
d['cleanversion'] = _clean_version_tag(d.get('version'))
dependency_links.append("{line}#egg={package_name}-{version}".format(
line=line,
package_name=d.get('package_name'),
version=d.get('cleanversion')
))
install_requires.append("{package_name}=={cleanversion}".format(**d))
else:
install_requires.append(line)
return install_requires, dependency_links
install_requires, dependency_links = dependencies_from_requirements('requirements.txt')
setup(
name='badgr-server',
version=version,
package_dir={'': "apps"},
packages=find_packages('apps'),
include_package_data=True,
license='GNU Affero General Public License v3',
description='Digital badge management for issuers, earners, and consumers',
long_description=README,
url='https://badgr.io/',
author='Concentric Sky',
author_email='[email protected]',
install_requires=install_requires,
dependency_links=dependency_links,
classifiers=[
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 1.10',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Affero General Public License v3',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Topic :: Education',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
)