forked from kapicorp/kapitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
77 lines (65 loc) · 2.36 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
#!/usr/bin/env python3
# Copyright 2019 The Kapitan Authors
# SPDX-FileCopyrightText: 2020 The Kapitan Authors <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0
"""Kapitan setup.py for PIP install."""
from setuptools import find_packages, setup
from kapitan.version import AUTHOR, AUTHOR_EMAIL, DESCRIPTION, LICENCE, PROJECT_NAME, URL, VERSION
# From https://github.com/pypa/pip/issues/3610#issuecomment-356687173
def install_deps():
"""Reads requirements.txt and preprocess it to be feed into setuptools.
This is the only possible way (we found)
how requirements.txt can be reused in setup.py
using dependencies from private github repositories.
Links must be appendend by `-{StringWithAtLeastOneNumber}`
or something like that, so e.g. `-9231` works as well as
`1.1.0`. This is ignored by the setuptools, but has to be there.
Returns:
list of packages and dependency links.
"""
with open("requirements.txt", "r") as f:
packages = f.readlines()
new_pkgs = []
links = []
for resource in packages:
if "git+https" in resource:
pkg = resource.split("#")[-1]
links.append(resource.strip() + "-9876543210")
new_pkgs.append(pkg.replace("egg=", "").rstrip())
else:
new_pkgs.append(resource.strip())
return new_pkgs, links
pkgs, new_links = install_deps()
setup(
name=PROJECT_NAME,
version=VERSION,
description=DESCRIPTION,
long_description=URL,
url=URL,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
license=LICENCE,
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
],
keywords="jsonnet kubernetes reclass jinja",
py_modules=["kapitan"],
python_requires=">=3.7",
packages=find_packages(),
include_package_data=True,
dependency_links=new_links,
install_requires=pkgs,
entry_points={
"console_scripts": [
"kapitan=kapitan.cli:main",
],
},
extras_require={"gojsonnet": ["gojsonnet==0.17.0"]},
)