-
Notifications
You must be signed in to change notification settings - Fork 69
/
setup.py
64 lines (51 loc) · 1.83 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
import os
import setuptools
import sys
# Importing fastentrypoints monkey-patches setuptools to avoid generating slow
# executables from the entry_points directive. See
# https://github.com/ninjaaron/fast-entry_points.
import fastentrypoints
# Written according to the docs at
# https://packaging.python.org/en/latest/distributing.html
project_root = os.path.dirname(__file__)
readme_file = os.path.join(project_root, 'README.md')
module_root = os.path.join(project_root, 'peru')
version_file = os.path.join(module_root, 'VERSION')
def get_version():
with open(version_file) as f:
return f.read().strip()
def get_all_resources_filepaths():
resources_paths = ['VERSION']
resources_dir = os.path.join(module_root, 'resources')
for dirpath, dirnames, filenames in os.walk(resources_dir):
relpaths = [
os.path.relpath(os.path.join(dirpath, f), start=module_root)
for f in filenames
]
resources_paths.extend(relpaths)
return resources_paths
def get_install_requires():
dependencies = ['docopt', 'PyYAML']
if sys.version_info < (3, 5):
raise RuntimeError('The minimum supported Python version is 3.5.')
return dependencies
def readme_text():
with open(readme_file) as f:
return f.read().strip()
setuptools.setup(
name='peru',
description='A tool for fetching code',
version=get_version(),
url='https://github.com/buildinspace/peru',
author="Jack O'Connor <[email protected]>, "
"Sean Olson <[email protected]>",
license='MIT',
packages=['peru'],
package_data={'peru': get_all_resources_filepaths()},
entry_points={'console_scripts': [
'peru=peru.main:main',
]},
install_requires=get_install_requires(),
long_description=readme_text(),
long_description_content_type='text/markdown',
)