This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
120 lines (102 loc) · 3.21 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
117
118
119
120
import io
import os
import sys
from shutil import rmtree
from setuptools import Command, Extension, setup
__version__ = "0.0.12"
__title__ = "polf"
HERE = os.path.abspath(os.path.dirname(__file__))
LINT_EXTRAS = [
'flake8==3.8.4',
'flake8-print==3.1.4',
'flake8-implicit-str-concat==0.2.0',
'isort==5.6.4',
'pre-commit==2.12.1',
'yamllint==1.25.0',
]
TEST_EXTRAS = [
'pytest==6.2.3',
]
DOC_EXTRAS = [
'Sphinx>=3.2.1',
'sphinx-rtd-theme==0.4.3',
]
DEV_EXTRAS = [
'bump2version==1.0.1',
] + TEST_EXTRAS + DOC_EXTRAS
with io.open(os.path.join(HERE, "README.md"), encoding="utf-8") as f:
LONG_DESCRIPTION = "\n" + f.read()
define_macros = []
extra_compile_args = []
extension = Extension(__title__,
language="c",
sources=[os.path.join('src', 'pypolf.c')],
define_macros=define_macros,
extra_compile_args=extra_compile_args)
class UploadCommand(Command):
"""Support setup.py upload."""
description = "Build and publish the package."
user_options = [
("test", None, "Specify if you want to test your upload to Pypi."),
]
@staticmethod
def status(s):
"""Prints things in bold."""
sys.stdout.write("\033[1m{0}\033[0m\n".format(s))
def initialize_options(self):
self.test = None
def finalize_options(self):
pass
def run(self):
try:
self.status("Removing previous builds…")
rmtree(os.path.join(HERE, "dist"))
except OSError:
pass
self.status("Building Source distribution…")
os.system("{0} setup.py sdist".format(sys.executable))
self.status("Uploading the package to PyPI via Twine…")
cmd = "twine upload%s dist/*" % (
" --repository-url https://test.pypi.org/legacy/" if self.test
else ""
)
os.system(cmd)
sys.exit()
setup(
name=__title__,
version=__version__,
description='Calculate points on lines.',
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
license="BSD License",
classifiers=[
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Image Processing",
"Topic :: Multimedia :: Graphics",
"Intended Audience :: Developers",
"Intended Audience :: Education",
],
python_requires='>=3.6',
zip_safe=False,
ext_modules=[extension],
include_package_data=True,
cmdclass={
"upload": UploadCommand,
},
extras_require={
"dev": DEV_EXTRAS,
"doc": DOC_EXTRAS,
"lint": LINT_EXTRAS,
"test": TEST_EXTRAS,
},
)