-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
66 lines (54 loc) · 1.92 KB
/
setup.py
File metadata and controls
66 lines (54 loc) · 1.92 KB
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
import codecs
import os.path
import re
import sys
import git
from setuptools import find_packages, setup
def load_dependencies(filename):
if not os.path.exists(filename):
return None, None
install_requires = []
dependency_links = []
for line in codecs.open(filename, encoding='utf-8'):
line = line.strip()
m = re.match(r'http.+#egg=(?P<pkgname>.+)', line)
if m:
dependency_links.append(line)
install_requires.append(m.groupdict()['pkgname'])
else:
install_requires.append(line)
return install_requires, dependency_links
install_requires, dependency_links = load_dependencies('requirements.txt')
def lazy_find_packages(*args, **kwargs):
if {'--name', '--version'} & set(sys.argv):
return None
return find_packages(*args, **kwargs)
def build_version(version_number):
git_repo = git.repo.Repo('.', search_parent_directories=True)
last_commit = [c for c in git_repo.iter_commits(max_count=1, paths='.')].pop()
version = '{}+{}'.format(version_number, last_commit.hexsha[:8])
return version
setup(
name='jumps_to_list',
version=build_version('1.0.0'),
url='https://github.com/tibk/jumps_to_list',
author='tibk',
author_email='secret',
description='dummy shared file',
packages=lazy_find_packages(exclude=['ez_setup', 'vendors']),
include_package_data=True,
zip_safe=False,
platforms='any',
install_requires=install_requires,
classifiers=[
'Development Status :: Release',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
]
)