printrun-src/setup.py

Wed, 20 Jan 2021 10:15:13 +0100

author
mdd
date
Wed, 20 Jan 2021 10:15:13 +0100
changeset 46
cce0af6351f0
parent 45
c82943fb205f
permissions
-rwxr-xr-x

updated and added new files for printrun

45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
1 #!/usr/bin/env python3
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
2
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
3 # This file is part of the Printrun suite.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
4 #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
5 # Printrun is free software: you can redistribute it and/or modify
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
6 # it under the terms of the GNU General Public License as published by
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
7 # the Free Software Foundation, either version 3 of the License, or
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
8 # (at your option) any later version.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
9 #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
10 # Printrun is distributed in the hope that it will be useful,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
13 # GNU General Public License for more details.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
14 #
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
15 # You should have received a copy of the GNU General Public License
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
16 # along with Printrun. If not, see <http://www.gnu.org/licenses/>.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
17
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
18 import ast
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
19 import glob
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
20 from setuptools import setup
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
21 from setuptools import find_packages
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
22
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
23 try:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
24 from Cython.Build import cythonize
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
25 extensions = cythonize("printrun/gcoder_line.pyx")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
26 from Cython.Distutils import build_ext
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
27 except ImportError as e:
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
28 print("WARNING: Failed to cythonize: %s" % e)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
29 # Debug helper: uncomment these:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
30 # import traceback
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
31 # traceback.print_exc()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
32 extensions = None
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
33 build_ext = None
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
34
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
35
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
36 with open('README.md') as f:
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
37 long_description = f.read()
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
38
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
39 with open('requirements.txt') as f:
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
40 install_requires = f.readlines()
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
41
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
42 with open('printrun/printcore.py') as f:
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
43 for line in f.readlines():
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
44 if line.startswith("__version__"):
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
45 __version__ = ast.literal_eval(line.split("=")[1].strip())
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
46
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
47
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
48 def multiglob(*globs):
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
49 paths = []
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
50 for g in globs:
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
51 paths.extend(glob.glob(g))
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
52 return paths
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
53
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
54
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
55 data_files = [
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
56 ('share/pixmaps', multiglob('*.png')),
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
57 ('share/applications', multiglob('*.desktop')),
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
58 ('share/metainfo', multiglob('*.appdata.xml')),
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
59 ('share/pronterface/images', multiglob('images/*.png',
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
60 'images/*.svg')),
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
61 ]
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
62
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
63 for locale in glob.glob('locale/*/LC_MESSAGES/'):
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
64 data_files.append((f'share/{locale}', glob.glob(f'{locale}/*.mo')))
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
65
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
66
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
67 setup(
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
68 name="Printrun",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
69 version=__version__,
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
70 description="Host software for 3D printers",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
71 author="Kliment Yanev, Guillaume Seguin and others",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
72 long_description=long_description,
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
73 long_description_content_type="text/markdown",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
74 url="http://github.com/kliment/Printrun/",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
75 license="GPLv3+",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
76 data_files=data_files,
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
77 packages=find_packages(),
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
78 scripts=["pronsole.py", "pronterface.py", "plater.py", "printcore.py"],
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
79 ext_modules=extensions,
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
80 python_requires=">=3.6",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
81 install_requires=install_requires,
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
82 setup_requires=["Cython"],
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
83 classifiers=[
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
84 "Environment :: X11 Applications :: GTK",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
85 "Intended Audience :: End Users/Desktop",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
86 "Intended Audience :: Manufacturing",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
87 "Intended Audience :: Science/Research",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
88 "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
89 "Operating System :: MacOS :: MacOS X",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
90 "Operating System :: Microsoft :: Windows",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
91 "Operating System :: POSIX :: Linux",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
92 "Programming Language :: Python :: 3 :: Only",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
93 "Programming Language :: Python :: 3.6",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
94 "Programming Language :: Python :: 3.7",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
95 "Programming Language :: Python :: 3.8",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
96 "Topic :: Printing",
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
97 ],
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
98 zip_safe=False,
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
99 )

mercurial