-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
126 lines (113 loc) · 4.09 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
""" Setup script for the Pyzo package.
Notes on how to do a release. Mostly for my own convenience:
* Write release notes
* Bump `__version__`
* Commit this to a new branch "bump" and push to GH. The CD freeze jobs will run.
* In online MacOS developer page, agree to license changes. Or certs won't work.
* Update freeze logic if necessary. Merge the pr.
* `git tag vx.y.z` and `git push vx.y.z` (builds the binaries and pushes to a GH release)
* Update links on Pyzo website
* `python setup.py sdist upload`
"""
import os
import sys
try:
from setuptools import find_packages, setup
except ImportError:
from distutils.core import setup
def get_version_and_doc(filename):
NS = dict(__version__="", __doc__="")
docStatus = 0 # Not started, in progress, done
with open(filename, "rb") as fd:
data = fd.read()
for line in data.decode().splitlines():
if line.startswith("__version__"):
exec(line.strip(), NS, NS)
elif line.startswith('"""'):
if docStatus == 0:
docStatus = 1
line = line.lstrip('"')
elif docStatus == 1:
docStatus = 2
if docStatus == 1:
NS["__doc__"] += line.rstrip() + "\n"
if not NS["__version__"]:
raise RuntimeError("Could not find __version__")
return NS["__version__"], NS["__doc__"]
version, doc = get_version_and_doc(
os.path.join(os.path.dirname(__file__), "pyzo", "__init__.py")
)
setup(
name="pyzo",
version=version,
description="the Python IDE for scientific computing",
long_description=doc,
author="Almar Klein",
author_email="[email protected]",
license="2-Clause BSD",
url="https://pyzo.org",
keywords="Python interactive IDE Qt science computing",
platforms="any",
provides=["pyzo"],
python_requires=">=3.6.0",
install_requires=[], # and 'PySide2' or 'PyQt5' or 'PySide6' or 'PyQt6'
packages=find_packages(exclude=["tests", "tests.*"]),
package_dir={"pyzo": "pyzo"},
package_data={
"pyzo": [
"resources/*.*",
"resources/icons/*.*",
"resources/appicons/*.*",
"resources/images/*.*",
"resources/fonts/*.*",
"resources/themes/*.*",
"resources/translations/*.*",
]
},
data_files=[
("", ["README.md", "LICENSE.md", "pyzo.appdata.xml", "pyzolauncher.py"])
],
zip_safe=False,
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"Intended Audience :: Developers",
"Topic :: Scientific/Engineering",
"Topic :: Software Development",
"License :: OSI Approved :: BSD License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"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",
],
entry_points={
"console_scripts": [
"pyzo = pyzo.__main__:main",
],
},
)
# Post processing:
# Install appdata.xml on Linux if we are installing in the system Python
if sys.platform.startswith("linux") and sys.prefix.startswith("/usr"):
if len(sys.argv) >= 2 and sys.argv[1] == "install":
fname = "pyzo.appdata.xml"
filename1 = os.path.join(os.path.dirname(__file__), fname)
filename2 = os.path.join("/usr/share/metainfo", fname)
try:
with open(filename1, "rb") as fd:
bb = fd.read()
with open(filename2, "wb") as fd:
fd.write(bb)
except PermissionError:
pass # No sudo, no need to warn
except Exception as err:
print("Could not install {}: {}".format(fname, err))
else:
print("Installed", fname)