-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
141 lines (125 loc) · 4.25 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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#############################################################################
# construct-gallery module
#############################################################################
from setuptools import setup
import re
import os
import json
from urllib import request
from pkg_resources import parse_version
###########################################################################
END_OF_INTRODUCTION = '## Example of basic usage'
EPILOGUE = (
"Full information, installation notes, API reference and usage details at "
"the [construct-gallery GitHub repository]"
"(https://github.com/Ircama/construct-gallery)."
)
DESCRIPTION = (
"construct-gallery GUI (based on wxPython) "
"and development widgets"
)
PACKAGE_NAME = "construct-gallery"
VERSIONFILE = "construct_gallery/__version__.py"
###########################################################################
def versions(pkg_name, site):
url = 'https://' + site + '.python.org/pypi/' + pkg_name + '/json'
print("Package " + pkg_name + ". Site URL: " + url)
try:
releases = json.loads(request.urlopen(url).read())['releases']
except Exception as e:
print("Error while getting data from URL '" + url + "': " + repr(e))
return []
return sorted(releases, key=parse_version, reverse=True)
with open("README.md", "r") as readme:
long_description = readme.read()
build = ''
ver_str_line = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, ver_str_line, re.M)
if mo:
verstr = mo.group(1)
else:
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))
if os.environ.get('GITHUB_RUN_NUMBER') is not None:
version_list_pypi = [
a for a in versions(PACKAGE_NAME, 'pypi') if a.startswith(verstr)]
version_list_testpypi = [
a for a in versions(PACKAGE_NAME, 'testpypi') if a.startswith(verstr)]
if (version_list_pypi or
version_list_testpypi or
os.environ.get('GITHUB_FORCE_RUN_NUMBER') is not None):
print(
'---------------------------------'
'---------------------------------'
)
print("Using build number " + os.environ['GITHUB_RUN_NUMBER'])
if version_list_pypi:
print(
"Version list available in pypi: " +
', '.join(version_list_pypi))
if version_list_testpypi:
print(
"Version list available in testpypi: " +
', '.join(version_list_testpypi))
print(
'---------------------------------'
'---------------------------------'
)
verstr += '-' + os.environ['GITHUB_RUN_NUMBER']
setup(
name=PACKAGE_NAME,
version=verstr,
description=DESCRIPTION,
long_description=long_description[
:long_description.find(END_OF_INTRODUCTION)
] + EPILOGUE,
long_description_content_type="text/markdown",
classifiers=[
"License :: Other/Proprietary License",
"Topic :: Software Development :: Libraries :: Python Modules",
'Programming Language :: Python :: 3 :: Only',
"Programming Language :: Python :: Implementation :: CPython",
"Development Status :: 5 - Production/Stable",
"Typing :: Typed",
"Intended Audience :: Developers",
],
author="Ircama",
url="https://github.com/Ircama/construct-gallery",
license='CC-BY-NC-SA-4.0',
packages=["construct_gallery"],
package_data={
"construct_gallery": ["py.typed"],
},
entry_points={
"gui_scripts": [
"construct-gallery=construct_gallery.__main__:main",
"bleak_scanner_construct=construct_gallery.__main__:ble_main"
]
},
include_package_data=True,
zip_safe=False,
install_requires=[
'construct_editor>=0.1.5',
'setuptools>=68.2.0',
'wxPython>=4.2.1',
'construct>=2.10.68',
],
keywords=[
"construct-gallery",
"construct-editor",
"module",
"gui",
"wx",
"wxpython",
"widget",
"binary",
"editor" "construct",
"bleak",
"BLE",
"bluetooth",
"plugin",
],
python_requires=">=3.8",
)