-
Notifications
You must be signed in to change notification settings - Fork 21
/
setup.py
executable file
·85 lines (65 loc) · 2.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
#!/usr/bin/env python
import json
import os
from setuptools import setup, find_packages
def path(fname=''):
return os.path.abspath(os.path.join(os.path.dirname(__file__), fname))
def readfile(fname):
with open(path(fname)) as f:
return f.read()
def scan_manifests():
for root, _, files in os.walk('platypush'):
for file in files:
if file == 'manifest.json':
yield os.path.join(root, file)
def parse_deps(deps):
ret = []
for dep in deps:
if dep.startswith('git+'):
continue # Don't include git dependencies in pip, or Twine will complain
ret.append(dep)
return ret
def parse_manifest(manifest_file):
with open(manifest_file) as f:
manifest = json.load(f).get('manifest')
if not manifest:
return None, None
name = '.'.join(manifest['package'].split('.')[2:])
return name, parse_deps(manifest.get('install', {}).get('pip', []))
def parse_manifests():
ret = {}
for manifest_file in scan_manifests():
name, deps = parse_manifest(manifest_file)
if deps:
ret[name] = deps
return ret
setup(
packages=find_packages(exclude=['tests']),
include_package_data=True,
extras_require=parse_manifests(),
package_data={
'platypush': [
'migrations/alembic.ini',
'migrations/alembic/*',
'migrations/alembic/**/*',
'install/**',
'install/scripts/*',
'install/scripts/**/*',
'install/requirements/*',
'install/docker/*',
'components.json.gz',
],
},
entry_points={
'console_scripts': [
'platypush=platypush:main',
'platydock=platypush.platydock:main',
'platyvenv=platypush.platyvenv:main',
],
},
install_requires=[
line.split('#')[0].strip()
for line in readfile('requirements.txt').splitlines()
if line.strip().split('#')[0].strip()
],
)