-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
160 lines (138 loc) · 5.79 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
#! /usr/bin/env python
# -*- coding: utf-8 -*-
try:
import sublime_api
except ImportError:
#
# Release process setup:
# https://github.com/pypa/twine
#
# For linux:
# sudo apt-get install python3-dbus
# python3 -m pip install --user keyring
# python3 -m keyring set https://upload.pypi.org/legacy/ your-username
# rm -rf ./dist && python3 setup.py sdist && twine upload dist/*
#
# For Windows, setup the password cache using `python.exe` from Anaconda:
# python -m pip install webencodings
# python -m pip install --user keyring
# python -m keyring set https://upload.pypi.org/legacy/ your-username
# rm -rf ./dist && python setup.py sdist && twine upload dist/*
#
# Run this to build the `dist/PACKAGE_NAME-xxx.tar.gz` file
# rm -rf ./dist && python3 setup.py sdist
#
# Run this to build & upload it to `pypi`, type your account name when prompted.
# twine upload dist/*
#
import re
import sys
import codecs
try:
# https://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package
filepath = 'all/debug_tools/version.py'
with open( filepath, 'r' ) as file:
__version__ ,= re.findall('__version__ = "(.*)"', file.read())
except Exception as error:
__version__ = "0.0.1"
sys.stderr.write( "Warning: Could not open '%s' due %s" % ( filepath, error ) )
try:
# https://stackoverflow.com/questions/30700166/python-open-file-error
with codecs.open( "README.md", 'r', errors='ignore' ) as file:
readme_contents = file.read()
except Exception as error:
readme_contents = ""
sys.stderr.write( "Warning: Could not open README.md due %s" % error )
# https://setuptools.readthedocs.io/en/latest/setuptools.html
from distutils.version import StrictVersion
from setuptools import setup
from setuptools import __version__ as setuptools_version
install_requires=[
]
# https://setuptools.readthedocs.io/en/latest/history.html
required_setup_tools = '20.5'
setuptools_matches = re.search( r"(\d+)(?:\.(\d+))?(?:\.(\d+))?", setuptools_version )
def matchgroup(index):
groupmatch = setuptools_matches.group(index)
if groupmatch:
return groupmatch
else:
return "0"
# https://github.com/anthony-tuininga/cx_Freeze/issues/340
if setuptools_matches:
setuptools_version = "%s.%s.%s" % ( matchgroup(1), matchgroup(2), matchgroup(3) )
sys.stderr.write( "Fixing setuptools_version from '%s' to '%s'\n" % ( setuptools_matches.string, setuptools_version ) )
# https://stackoverflow.com/questions/48048745/setup-py-require-a-recent-version-of-setuptools-before-trying-to-install
if StrictVersion( setuptools_version ) < StrictVersion( required_setup_tools ):
sys.stderr.write( " Warning: Your setuptools version '%s' is not fully support this package.\n"
"Please upgrade your setuptools to '%s' or newer and repeat the installation.\n"
" pip install setuptools --upgrade\n"
" pip3 install setuptools --upgrade\n" % (
setuptools_version, required_setup_tools )
)
extras_require = {}
else:
# To install use: pip install -e .[full]
# To install use: pip install -e debug_tools[full]
# To install use: pip install -e debug_tools debug_tools[full]
extras_require = {
'full': [
"natsort",
"diff-match-patch",
'portalocker; python_version>"3.4"',
'concurrent-log-handler; python_version>"3.4"',
],
'diff': [
"diff-match-patch",
],
'sort': [
"natsort",
],
'lock': [
'portalocker; python_version>"3.4"',
'concurrent-log-handler; python_version>"3.4"',
],
}
if sys.platform.startswith("win") or sys.platform.startswith("cyg"):
extras_require['full'].append('pypiwin32;python_version>"3.4"')
extras_require['lock'].append('pypiwin32;python_version>"3.4"')
setup \
(
name='debug_tools',
version = __version__,
description = 'Python Distribution Logger, Debugger and Utilities',
author = 'Evandro Coan',
license = "GPLv3",
url = 'https://github.com/evandrocoan/debug_tools',
package_dir = {
'': 'all'
},
packages = [
'debug_tools',
],
data_files = [
("", ["LICENSE.txt"]),
],
extras_require = extras_require,
install_requires = install_requires,
long_description = readme_contents,
long_description_content_type='text/markdown',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.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',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)