-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
92 lines (73 loc) · 2.72 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
# stdlib
import os
# deps
from setuptools import Command, find_packages, setup
# Dynamically calculate the version based on anon.VERSION
VERSION = __import__("anon").__version__
with open("README.rst") as readme_file:
def remove_banner(readme):
# Since PyPI does not support raw directives, we remove them from the README
#
# raw directives are only used to make README fancier on GitHub and do not
# contain relevant information to be displayed in PyPI, as they are not tied
# to the current version, but to the current development status
out = []
lines = iter(readme.splitlines(True))
for line in lines:
if line.startswith(".. BANNERSTART"):
for line in lines:
if line.strip() == ".. BANNEREND":
break
else:
out.append(line)
return "".join(out)
README = remove_banner(readme_file.read())
class PublishCommand(Command):
description = "Publish to PyPI"
user_options = []
def run(self):
# Build & Upload
# https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives
# https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives
os.system("python setup.py sdist bdist_wheel")
os.system("twine upload dist/*")
def initialize_options(self):
pass
def finalize_options(self):
pass
class CreateTagCommand(Command):
description = "Create release tag"
user_options = []
def run(self):
os.system("git tag -a %s -m 'v%s'" % (VERSION, VERSION))
os.system("git push --tags")
def initialize_options(self):
pass
def finalize_options(self):
pass
setup(
name="django-anon",
version=VERSION,
packages=find_packages(),
install_requires=["django-bulk-update", "django-chunkator<2"],
cmdclass={"publish": PublishCommand, "tag": CreateTagCommand},
# metadata for upload to PyPI
description="Anonymize production data so it can be safely used in not-so-safe environments",
long_description=README,
long_description_content_type="text/x-rst",
author="Tesorio",
author_email="[email protected]",
url="https://github.com/Tesorio/django-anon",
license="MIT",
platforms=["any"],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Framework :: Django",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
],
)