-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
executable file
·189 lines (151 loc) · 4.41 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Build the egg file for burger for python
setup.py clean
setup.py sdist bdist_wheel
twine upload --verbose dist/*
cd docs
sphinx-build -M html . temp\build
Copyright 2013-2024 by Rebecca Ann Heineman [email protected]
It is released under an MIT Open Source license. Please see LICENSE
for license details. Yes, you can use it in a
commercial title without paying anything, just give me a credit.
Please? It's not like I'm asking you for money!
"""
from __future__ import absolute_import, print_function, unicode_literals
import io
import os
import sys
import setuptools
CWD = os.path.dirname(os.path.abspath(__file__))
# Project specific strings
PROJECT_NAME = "burger"
PROJECT_KEYWORDS = [
"burger",
"perforce",
"burgerlib",
"development",
"python",
"windows"
]
# Manually import the project
PROJECT_MODULE = __import__(PROJECT_NAME)
# Read me file is the long description
with io.open(os.path.join(CWD, "README.rst"), encoding="utf-8") as filep:
LONG_DESCRIPTION = filep.read()
# Create the dependency list
INSTALL_REQUIRES = [
"setuptools >= 1.0.0",
"wslwinreg >= 1.0.8"
]
# Project classifiers
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Topic :: Software Development",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Natural Language :: English",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12"
]
# Extra files to include in the form of this tuple (directory,[files])
DATA_FILES = [
# (PROJECT_NAME, ["LICENSE.txt"])
]
#
# Parms for setup
#
SETUP_ARGS = dict(
name=PROJECT_NAME,
version=PROJECT_MODULE.__version__,
# Use the readme as the long description
description=PROJECT_MODULE.__summary__,
long_description=LONG_DESCRIPTION,
# long_description_content_type="text/x-rst; charset=UTF-8",
license=PROJECT_MODULE.__license__,
url=PROJECT_MODULE.__uri__,
author=PROJECT_MODULE.__author__,
author_email=PROJECT_MODULE.__email__,
keywords=PROJECT_KEYWORDS,
platforms=["Any"],
install_requires=INSTALL_REQUIRES,
zip_safe=False,
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
classifiers=CLASSIFIERS,
packages=[PROJECT_NAME],
include_package_data=True,
data_files=DATA_FILES
)
########################################
CLEAN_DIR_LIST = [
PROJECT_NAME + ".egg-info",
PROJECT_NAME + "-" + PROJECT_MODULE.__version__,
"dist",
"build",
"temp",
".pytest_cache",
".tox",
".vscode"
]
CLEAN_DIR_RECURSE_LIST = (
"temp",
"__pycache__",
"_build"
)
CLEAN_EXTENSION_LIST = (
"*.pyc",
"*.pyo"
)
def clean(working_dir):
"""
Clean up all the temp files after uploading
Helps in keeping source control from having to track
temp files
"""
# Delete all folders, including read only files
for item in CLEAN_DIR_LIST:
PROJECT_MODULE.delete_directory(os.path.join(working_dir, item))
PROJECT_MODULE.clean_directories(
working_dir,
CLEAN_DIR_RECURSE_LIST,
recursive=True)
#
# Delete all *.pyc and *.pyo files
#
PROJECT_MODULE.clean_files(
working_dir,
name_list=CLEAN_EXTENSION_LIST,
recursive=True)
#
# Perform the setup
#
if __name__ == "__main__":
# Ensure the directory is the current one
if CWD:
os.chdir(CWD)
# Perform a thorough cleaning job
if "clean" in sys.argv:
clean(CWD)
# Unlock the files to handle Perforce locking
LOCK_LIST = PROJECT_MODULE.unlock_files(CWD) + \
PROJECT_MODULE.unlock_files(os.path.join(CWD, PROJECT_NAME))
try:
setuptools.setup(**SETUP_ARGS)
# If any files were unlocked, relock them
finally:
PROJECT_MODULE.lock_files(LOCK_LIST)