-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
123 lines (106 loc) · 4.92 KB
/
setup.py
File metadata and controls
123 lines (106 loc) · 4.92 KB
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
# also available through the world wide web at this URL:
# http://opensource.org/licenses/OSL-3.0
# If you did not receive a copy of the license and are unable to obtain it
# Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/)
# http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
if __name__=='__main__':
from setuptools import find_namespace_packages, find_packages, setup
from setuptools import Command
from dhp import (__author__, __author_email__, __description__,
__keywords__, __license__, __license_files__,
__packagename__, __platforms__, __url__, __version__)
from dhp.lib_utils import ensure_license, parse_requirements
with open("README.md",'r') as f:
LONG_DESCRIPTION = f.read()
LONG_DESCRIPTION_CONTENT_TYPE = 'text/markdown'
PKG_DIR = 'dhp'
PYTHON_REQUIRES = '>=3.7'
REQUIREMENTS_PATH = 'requirements.txt'
# from https://pypi.org/classifiers/
CLASSIFIER = [
'Development Status :: 4 - Beta',
'Environment :: X11 Applications',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Manufacturing',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Open Software License 3.0 (OSL-3.0)',
'Natural Language :: English',
'Natural Language :: Vietnamese',
'Operating System :: OS Independent',
# 'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Image Processing',
'Topic :: Scientific/Engineering :: Image Recognition',
'Topic :: Scientific/Engineering :: Information Analysis',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Visualization',
'Topic :: Software Development :: Debuggers',
'Topic :: System :: Logging',
'Topic :: Utilities',
]
class UploadCommand(Command):
"""Support setup.py upload."""
description = 'Build and publish the package.'
user_options = []
@staticmethod
def status(s):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(s))
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import os, sys
from shutil import rmtree
here = os.path.abspath(os.path.dirname(__file__))
try:
self.status('Removing previous builds…')
rmtree(os.path.join(here, 'dist'))
except OSError:
pass
self.status('Building Source and Wheel (universal) distribution…')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
self.status('Uploading the package to PyPI via Twine…')
os.system('twine upload dist/*')
self.status('Pushing git tags…')
os.system('git tag v{0}'.format(__version__))
os.system('git push --tags')
sys.exit()
ensure_license(path=PKG_DIR)
# import pdb; pdb.set_trace()
setup(
name = __packagename__,
version = __version__,
description = __description__,
long_description = LONG_DESCRIPTION,
long_description_content_type = LONG_DESCRIPTION_CONTENT_TYPE,
author = __author__,
author_email = __author_email__,
maintainer = __author__,
maintainer_email = __author_email__,
url = __url__,
# download_url = ,
platforms = __platforms__,
license = __license__,
license_files = __license_files__,
python_requires = PYTHON_REQUIRES,
packages = find_namespace_packages(include=[f'{PKG_DIR}.*']), #, exclude=["tests", "*.tests", "*.tests.*", "tests.*"]),
# packages = find_packages(where=PKG_DIR),
# namespace_packages = ['dhp'],
install_requires = parse_requirements(REQUIREMENTS_PATH),
keywords = __keywords__,
classifier = CLASSIFIER,
# $ setup.py publish support.
# cmdclass={
# 'upload': UploadCommand,
# },
)