Skip to content

Commit 65e2d18

Browse files
author
zhenwei-li
committed
the setup script upgrade
1 parent d9796bf commit 65e2d18

2 files changed

Lines changed: 22 additions & 9 deletions

File tree

Temp/archives/material/setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def read_text(file_name):
7575
DVSNIER_AUTHOR_EMAIL = 'dovsnier@qq.com' # Optional
7676
DVSNIER_LICENSE = 'MIT' # Optional
7777
DVSNIER_CLASSIFIERS = [ # Optional
78+
#
79+
# https://pypi.org/classifiers/
80+
#
7881
# How mature is this project? Common values are
7982
# 3 - Alpha
8083
# 4 - Beta
@@ -107,7 +110,6 @@ def read_text(file_name):
107110
# DVSNIER_PYTHON_REQUIRES = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*'
108111
DVSNIER_PYTHON_REQUIRES = '>=2.7, <4'
109112
DVSNIER_INSTALL_REQUIRES = [ # Optional
110-
111113
]
112114
DVSNIER_EXTRAS_REQUIRE = { # Optional
113115
'dev': ['check-manifest'],

setup.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
# Always prefer setuptools over distutils
10+
# from setuptools import setup, find_packages, find_namespace_packages
1011
from setuptools import setup, find_packages
1112
import os
1213
import sys
@@ -26,9 +27,10 @@ def read_text(file_name):
2627
return content
2728

2829

29-
PROJECT_PREFIX = '/Users/dovsnier/Documents/Work_Space_Python/Python-DeMo/'
30-
project = PROJECT_PREFIX
31-
# print(project)
30+
project = os.getenv('BASE_PROJECT_PREFIX')
31+
if project is None:
32+
raise KeyError('the please configure BASE_PROJECT_PREFIX environment variable, otherwise it cannot run')
33+
print(project)
3234
PROJECT_DIRECTORY = 'process' # project directory
3335
PROJECT_README_FILE = 'README.md' # project readme file
3436
README_ROOT_DIRECTORY = os.path.join(project, 'doc/description')
@@ -104,14 +106,10 @@ def read_text(file_name):
104106
# DVSNIER_PY_MODULES = ["xxx"] # Required
105107
# DVSNIER_PACKAGES = find_packages(include=['xxx', 'xxx.*']) # Required
106108
DVSNIER_PACKAGES = find_packages(where='src') # Required
109+
# DVSNIER_NAMESPACE_PACKAGES = find_namespace_packages(include=['com.*']) # Required
107110
# DVSNIER_PYTHON_REQUIRES = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*'
108111
DVSNIER_PYTHON_REQUIRES = '>=2.7, <4'
109112
DVSNIER_INSTALL_REQUIRES = [ # Optional
110-
# 'discover==0.4.0',
111-
# 'build==0.4.0',
112-
# 'pathlib2==2.3.5',
113-
# 'toml==0.10.2',
114-
# 'twine==1.15.0',
115113
]
116114
DVSNIER_EXTRAS_REQUIRE = { # Optional
117115
'dev': ['check-manifest'],
@@ -241,6 +239,11 @@ def read_text(file_name):
241239
#
242240
packages=DVSNIER_PACKAGES, # Required
243241

242+
#
243+
# Only for Python 3.x and above
244+
#
245+
# namespace_packages=DVSNIER_NAMESPACE_PACKAGES, # Optional
246+
244247
# If your project contains any single-file Python modules that aren’t part of
245248
# a package, set py_modules to a list of the names of the modules (minus the .py
246249
# extension) in order to make setuptools aware of them.
@@ -292,6 +295,14 @@ def read_text(file_name):
292295
# executes the function `main` from this package when invoked:
293296
entry_points=DVSNIER_ENTRY_POINTS, # Optional
294297

298+
#
299+
# 1. https://www.python.org/dev/peps/pep-0328/
300+
# 2. https://setuptools.readthedocs.io/en/latest/userguide/package_discovery.html
301+
# 3. https://packaging.python.org/guides/packaging-namespace-packages/
302+
# 4. https://github.com/pypa/sample-namespace-packages/tree/master/pkgutil
303+
#
304+
zip_safe=False,
305+
295306
# List additional URLs that are relevant to your project as a dict.
296307
#
297308
# This field corresponds to the "Project-URL" metadata fields:

0 commit comments

Comments
 (0)