-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
64 lines (56 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
from setuptools import setup, find_packages
import os
import subprocess
import codecs
import sys
base_dir = os.path.abspath(os.path.dirname(__file__))
src_dir = os.path.join(base_dir, 'src')
# When executing the setup.py, we need to be able to import ourselves, this
# means that we need to add the src/ directory to the sys.path.
sys.path.insert(0, src_dir)
about = {}
with open(os.path.join(src_dir, 'repovisor', '__about__.py')) as f:
exec(f.read(), about)
def genRST():
pandoc_call = ['pandoc', '--from=markdown', '--to=rst', 'README.md']
try:
output = subprocess.run(pandoc_call, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if output.returncode:
print(output.stderr)
sys.exit()
output = output.stdout
except AttributeError:
try:
output = subprocess.check_output(pandoc_call)
except subprocess.CalledProcessError:
sys.exit()
return output.decode()
# get the dependencies and installs
with codecs.open(os.path.join(base_dir, 'requirements.txt'), encoding='utf-8') as f:
all_reqs = f.read().split('\n')
install_requires = [x.strip() for x in all_reqs if 'git+' not in x]
dependency_links = [x.strip().replace('git+', '') for x in all_reqs if x.startswith('git+')]
setup(
name=about['__title__'],
version=about['__version__'],
description=about['__summary__'],
long_description=genRST(),
url=about['__uri__'],
license=about['__license__'],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
],
keywords='git, repository, manager',
packages=find_packages(where='src', exclude=['docs', 'tests*']),
package_dir={'': 'src'},
include_package_data=True,
author=about['__author__'],
install_requires=install_requires,
dependency_links=dependency_links,
author_email=about['__email__'],
entry_points={
'console_scripts': ['repovise=repovisor.__main__:main'],
}
)