-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
executable file
·63 lines (53 loc) · 1.61 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
from setuptools import find_packages, setup
def find_version(filename):
filepath = os.path.join(os.path.dirname(__file__), filename)
with open(filepath) as init:
for line in init:
if line.startswith('__version__'):
x, version = line.split('=', 1)
return version.strip().strip('\'"')
else:
raise ValueError('Cannot find the version in {0}'.format(filename))
def parse_requirements(requirements_txt):
requirements = []
try:
with open(requirements_txt, 'rb') as f:
for line in f:
line = line.strip()
if line.startswith('#') or not line:
continue
if line.startswith('-'):
raise ValueError('Unexpected command {0} in {1}'.format(
line,
requirements_txt,
))
requirements.append(line)
return requirements
except IOError:
return []
build_info = dict(
name='napixd',
version=find_version('napixd/__init__.py'),
packages=find_packages(
exclude=[
'napixd.examples',
'tests',
'tests.*',
]
),
url='http://napix.io',
author='Enix',
author_email='gr@enix.org',
install_requires=parse_requirements('requirements.txt'),
include_package_data=True,
scripts=[
'bin/napixd',
'bin/napixd-template',
'bin/napixd-store',
],
)
if __name__ == '__main__':
setup(**build_info)