-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
68 lines (53 loc) · 1.92 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
import codecs
import os
import sys
from setuptools import find_packages, setup
from setuptools.command.install import install
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.md"), encoding="utf-8") as file:
long_description = file.read()
def read(rel_path):
with codecs.open(os.path.join(here, rel_path), "r") as file:
return file.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")
version = get_version("src/rsaidnumber/__init__.py")
class VerifyVersionCommand(install):
"""Custom command to verify that the git tag matches our version."""
description = "verify that the git tag matches our version"
def run(self):
tag = os.getenv("CIRCLE_TAG")
if tag != version:
info = (
"Git tag '{0}' does not match the version of this package: {1}"
).format(tag, version)
sys.exit(info)
setup(
name="rsa-id-number",
version=version,
description="South African ID number utilities",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/teamgeek-io/rsa-id-number",
author="Teamgeek",
author_email="support@teamgeek.io",
license="MIT",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
],
keywords="utilities, development",
package_dir={"": "src"},
packages=find_packages(where="src"),
python_requires=">=3.6",
install_requires=[],
cmdclass={"verify": VerifyVersionCommand},
)