-
Notifications
You must be signed in to change notification settings - Fork 21
/
setup.py
116 lines (91 loc) · 3.07 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env python3
import distutils.spawn
import os.path as osp
import shlex
import subprocess
import sys
from setuptools import find_packages, setup
def readme():
with open("README.md") as f:
content = f.read()
return content
def find_version():
version_file = "equilib/info.py"
with open(version_file, "r") as f:
exec(compile(f.read(), version_file, "exec"))
return locals()["__version__"]
def find_author():
version_file = "equilib/info.py"
with open(version_file, "r") as f:
exec(compile(f.read(), version_file, "exec"))
return locals()["__author__"]
def find_email():
version_file = "equilib/info.py"
with open(version_file, "r") as f:
exec(compile(f.read(), version_file, "exec"))
return locals()["__email__"]
def find_description():
version_file = "equilib/info.py"
with open(version_file, "r") as f:
exec(compile(f.read(), version_file, "exec"))
return locals()["__description__"]
def find_url():
version_file = "equilib/info.py"
with open(version_file, "r") as f:
exec(compile(f.read(), version_file, "exec"))
return locals()["__url__"]
def get_requirements(filename="requirements.txt"):
here = osp.dirname(osp.realpath(__file__))
with open(osp.join(here, filename), "r") as f:
requires = [line.replace("\n", "") for line in f.readlines()]
return requires
def get_long_description():
with open("README.md") as f:
long_description = f.read()
try:
import github2pypi
return github2pypi.replace_url(
slug="haruishi43/equilib", content=long_description
)
except Exception:
return long_description
if sys.argv[1] == "release":
if not distutils.spawn.find_executable("twine"):
print("Please install twine:\n\n\tpip install twine\n", file=sys.stderr)
sys.exit(1)
commands = [
"git pull origin master",
"git tag {:s}".format(find_version()),
"git push origin master --tag",
"python setup.py sdist bdist_wheel",
"twine upload dist/pyequilib-{:s}.tar.gz".format(find_version()),
]
for cmd in commands:
subprocess.check_call(shlex.split(cmd))
sys.exit(0)
setup(
name="pyequilib",
version=find_version(),
packages=find_packages(
exclude=["github2pypi", "tests", "scripts", "results", "data"]
),
description=find_description(),
long_description=get_long_description(),
long_description_content_type="text/markdown",
author=find_author(),
author_email=find_email(),
license="Apache License 2.0",
url=find_url(),
install_requires=["numpy"],
keywords=["Equirectangular", "Computer Vision"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
python_requires=">=3.6",
)