forked from alicevision/Meshroom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
145 lines (132 loc) · 4.32 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
import platform
import os
import setuptools # for bdist
from cx_Freeze import setup, Executable
import meshroom
currentDir = os.path.dirname(os.path.abspath(__file__))
class PlatformExecutable(Executable):
"""
Extend cx_Freeze.Executable to handle platform variations.
"""
Windows = "Windows"
Linux = "Linux"
Darwin = "Darwin"
exeExtensions = {
Windows: ".exe",
Linux: "",
Darwin: ".app"
}
def __init__(self, script, initScript=None, base=None, targetName=None, icons=None, shortcutName=None,
shortcutDir=None, copyright=None, trademarks=None):
# despite supposed to be optional, targetName is actually required on some configurations
if not targetName:
targetName = os.path.splitext(os.path.basename(script))[0]
# add platform extension to targetName
targetName += PlatformExecutable.exeExtensions[platform.system()]
# get icon for platform if defined
icon = icons.get(platform.system(), None) if icons else None
if platform.system() in (self.Linux, self.Darwin):
initScript = os.path.join(currentDir, "setupInitScriptUnix.py")
super(PlatformExecutable, self).__init__(script, initScript, base, targetName, icon, shortcutName,
shortcutDir, copyright, trademarks)
build_exe_options = {
# include dynamically loaded plugins
"packages": ["meshroom.nodes", "meshroom.submitters"],
"includes": [
"idna.idnadata", # Dependency needed by SketchfabUpload node, but not detected by cx_Freeze
],
"include_files": ["CHANGES.md", "COPYING.md", "LICENSE-MPL2.md", "README.md"]
}
if os.path.isdir(os.path.join(currentDir, "tractor")):
build_exe_options["packages"].append("tractor")
if os.path.isdir(os.path.join(currentDir, "simpleFarm")):
build_exe_options["packages"].append("simpleFarm")
if platform.system() == PlatformExecutable.Linux:
# include required system libs
# from https://github.com/Ultimaker/cura-build/blob/master/packaging/setup_linux.py.in
build_exe_options.update({
"bin_path_includes": [
"/lib",
"/lib64",
"/usr/lib",
"/usr/lib64",
],
"bin_includes": [
"libssl3",
"libssl",
"libcrypto",
],
"bin_excludes": [
"linux-vdso.so",
"libpthread.so",
"libdl.so",
"librt.so",
"libstdc++.so",
"libm.so",
"libgcc_s.so",
"libc.so",
"ld-linux-x86-64.so",
"libz.so",
"libgcc_s.so",
"libglib-2",
"librt.so",
"libcap.so",
"libGL.so",
"libglapi.so",
"libXext.so",
"libXdamage.so",
"libXfixes.so",
"libX11-xcb.so",
"libX11.so",
"libxcb-glx.so",
"libxcb-dri2.so",
"libxcb.so",
"libXxf86vm.so",
"libdrm.so",
"libexpat.so",
"libXau.so",
"libglib-2.0.so",
"libgssapi_krb5.so",
"libgthread-2.0.so",
"libk5crypto.so",
"libkeyutils.so",
"libkrb5.so",
"libkrb5support.so",
"libresolv.so",
"libutil.so",
"libXrender.so",
"libcom_err.so",
"libgssapi_krb5.so",
]
})
executables = [
# GUI
PlatformExecutable(
"meshroom/ui/__main__.py",
targetName="Meshroom",
icons={PlatformExecutable.Windows: "meshroom/ui/img/meshroom.ico"}
),
# Command line
PlatformExecutable("bin/meshroom_batch"),
PlatformExecutable("bin/meshroom_compute"),
PlatformExecutable("bin/meshroom_newNodeType"),
PlatformExecutable("bin/meshroom_statistics"),
PlatformExecutable("bin/meshroom_status"),
PlatformExecutable("bin/meshroom_submit"),
]
setup(
name="Meshroom",
description="Meshroom",
install_requires=['psutil', 'pytest', 'PySide2', 'markdown'],
extras_require={
':python_version < "3.4"': [
'enum34',
],
},
setup_requires=[
'cx_Freeze'
],
version=meshroom.__version__,
options={"build_exe": build_exe_options},
executables=executables,
)