-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
executable file
·90 lines (78 loc) · 2.7 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
#!/usr/bin/env python3
# Copyright (C) 2020-2021 Dimitrios-Georgios Akestoridis
#
# This file is part of Zigator.
#
# Zigator is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 only,
# as published by the Free Software Foundation.
#
# Zigator is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Zigator. If not, see <https://www.gnu.org/licenses/>.
"""
Setup script for the ``zigator`` package.
"""
import importlib
import os
import sys
import setuptools
def setup():
"""
Customize the setup process of the ``zigator`` package.
"""
top_dirpath = os.path.dirname(os.path.abspath(__file__))
pkg_dirpath = os.path.join(top_dirpath, "zigator")
metadata = {}
with open(
os.path.join(pkg_dirpath, "_metadata.py"),
mode="r",
encoding="utf-8",
) as fp:
exec(fp.read(), metadata)
long_description = ""
with open(
os.path.join(top_dirpath, "README.md"),
mode="r",
encoding="utf-8",
) as fp:
comment_counter = 0
for line in fp:
if line == "<!-- START OF BADGES -->\n":
comment_counter += 1
elif line == "<!-- END OF BADGES -->\n":
comment_counter -= 1
elif comment_counter == 0:
long_description += line
version_spec = importlib.util.spec_from_file_location(
"_version",
os.path.join(pkg_dirpath, "_version.py"),
)
version_module = importlib.util.module_from_spec(version_spec)
sys.modules["_version"] = version_module
version_spec.loader.exec_module(version_module)
setuptools.setup(
name=metadata["__title__"],
version=version_module.get_version(pkg_dirpath),
author=metadata["__author__"],
author_email=metadata["__author_email__"],
description=metadata["__description__"],
long_description=long_description,
long_description_content_type="text/markdown",
license=metadata["__license__"],
url=metadata["__url__"],
keywords=metadata["__keywords__"],
classifiers=metadata["__classifiers__"],
install_requires=metadata["__install_requires__"],
python_requires=metadata["__python_requires__"],
entry_points=metadata["__entry_points__"],
include_package_data=True,
zip_safe=False,
packages=setuptools.find_packages(),
)
if __name__ == "__main__":
setup()