forked from zbohm/django-forms-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
82 lines (77 loc) · 2.51 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
import os
from shutil import rmtree
import sys
from setuptools import setup, find_packages
exclude = [
"forms_builder/example_project/dev.db",
"forms_builder/example_project/local_settings.py",
]
exclude = dict([(e, None) for e in exclude])
for e in exclude:
if e.endswith(".py"):
try:
os.remove("%sc" % e)
except Exception:
pass
try:
with open(e, "r") as f:
exclude[e] = (f.read(), os.stat(e))
os.remove(e)
except Exception:
pass
if sys.argv[:2] == ["setup.py", "bdist_wheel"]:
# Remove previous build dir when creating a wheel build,
# since if files have been removed from the project,
# they'll still be cached in the build dir and end up
# as part of the build, which is unexpected.
try:
rmtree("build")
except Exception:
pass
try:
setup(
name="django-forms-builder",
version=__import__("forms_builder").__version__,
author="Stephen McDonald",
author_email="[email protected]",
description=(
"A Django reusable app providing the ability for "
"admin users to create their own forms and report "
"on their collected data."
),
long_description=open("README.rst").read(),
license="BSD",
url="http://github.com/stephenmcd/django-forms-builder",
zip_safe=False,
include_package_data=True,
packages=find_packages(),
install_requires=[
"sphinx-me >= 0.1.2",
"unidecode",
"django >= 3.2, < 4.3",
],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Framework :: Django",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Internet :: WWW/HTTP :: Site Management",
],
)
finally:
for e in exclude:
if exclude[e] is not None:
data, stat = exclude[e]
try:
with open(e, "w") as f:
f.write(data)
os.chown(e, stat.st_uid, stat.st_gid)
os.chmod(e, stat.st_mode)
except Exception:
pass