-
Notifications
You must be signed in to change notification settings - Fork 999
/
setup.py
executable file
·74 lines (58 loc) · 2.13 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
#!/usr/bin/env python3
# This file is part of the Printrun suite.
#
# Printrun is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Printrun is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
import ast
import glob
from setuptools import Extension, find_packages, setup
def get_install_requires():
with open('requirements.txt') as f:
return f.readlines()
def get_version():
with open('printrun/printcore.py', encoding="utf-8") as f:
for line in f.readlines():
if line.startswith("__version__"):
return ast.literal_eval(line.split("=")[1].strip())
return "unknown"
def multiglob(*globs):
paths = []
for g in globs:
paths.extend(glob.glob(g))
return paths
def get_data_files():
data_files = [
('share/pixmaps', multiglob('*.png')),
('share/applications', multiglob('*.desktop')),
('share/metainfo', multiglob('*.appdata.xml')),
('share/pronterface/images', multiglob('images/*.png',
'images/*.svg')),
]
for locale in glob.glob('locale/*/LC_MESSAGES/'):
data_files.append((f'share/{locale}', glob.glob(f'{locale}/*.mo')))
return data_files
def get_extensions():
extensions = [
Extension(name="printrun.gcoder_line",
sources=["printrun/gcoder_line.pyx"])
]
return extensions
setup(
version=get_version(),
data_files=get_data_files(),
packages=find_packages(),
scripts=["pronsole.py", "pronterface.py", "plater.py", "printcore.py"],
ext_modules=get_extensions(),
install_requires=get_install_requires(),
zip_safe=False,
)