-
Notifications
You must be signed in to change notification settings - Fork 12
/
setup.py
143 lines (126 loc) · 4.04 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
#!/usr/bin/env python
# encoding: UTF-8
import os
import subprocess
from setuptools import setup, find_packages
from setuptools.command.build_ext import build_ext
def _find_msbuild(plat_spec="x64"):
from setuptools import msvc
if hasattr(msvc, "msvc14_get_vc_env"):
vc_env = msvc.msvc14_get_vc_env(plat_spec)
if "vsinstalldir" in vc_env:
msbuild_path = os.path.join(
vc_env["vsinstalldir"],
"MSBuild",
"Current",
"Bin",
"MSBuild.exe",
)
if os.path.isfile(msbuild_path):
return msbuild_path
for path in msvc.EnvironmentInfo(plat_spec).VCTools:
if "\\VC\\" not in path:
continue
msbuild_path = os.path.join(
path[: path.index("\\VC\\")],
"MSBuild",
"Current",
"Bin",
"MSBuild.exe",
)
if os.path.isfile(msbuild_path):
return msbuild_path
raise Exception("Unable to find any Visual Studio installation")
class CustomBuildExt(build_ext):
def build_extensions(self):
if not os.path.isdir("./assimp/build"):
os.mkdir("./assimp/build")
os.chdir("./assimp/build")
if self.compiler.compiler_type == "unix":
os.environ["CXXFLAGS"] = "--std=c++11 %s" % os.environ.get(
"CXXFLAGS", ""
)
subprocess.call(
[
"cmake",
"..",
"-DBUILD_SHARED_LIBS=OFF",
"-DASSIMP_BUILD_ASSIMP_TOOLS=OFF",
"-DASSIMP_BUILD_TESTS=OFF",
"-DASSIMP_BUILD_ZLIB=ON",
]
)
subprocess.call(["make"])
elif self.compiler.compiler_type == "msvc":
msbuild = _find_msbuild()
subprocess.call(
[
"cmake",
"..",
"-DBUILD_SHARED_LIBS=OFF",
"-DASSIMP_BUILD_ASSIMP_TOOLS=OFF",
"-DASSIMP_BUILD_TESTS=OFF",
"-DASSIMP_BUILD_ZLIB=ON",
"-DLIBRARY_SUFFIX=",
]
)
subprocess.call(
[msbuild, "-p:Configuration=Release", "Assimp.sln"]
)
else:
raise Exception("Unsupported platform")
os.chdir("../..")
build_ext.build_extensions(self)
long_description = ""
if os.path.isfile("README.rst"):
long_description = open("README.rst", "r").read()
setup(
name="yoga",
version="1.3.3",
description="Yummy Optimizer for Gorgeous Assets",
url="https://github.com/wanadev/yoga",
project_urls={
"Source Code": "https://github.com/wanadev/yoga",
"Documentation": "https://wanadev.github.io/yoga/",
"Changelog": "https://github.com/wanadev/yoga#changelog",
"Issues": "https://github.com/wanadev/yoga/issues",
"Chat": "https://discord.gg/BmUkEdMuFp",
},
license="BSD-3-Clause",
long_description=long_description,
keywords="image webp jpeg png optimizer guetzli zopfli zopflipng libwebp 3d model mesh assimp gltf glb converter",
author="Wanadev",
author_email="[email protected]",
maintainer="Fabien LOISON, Alexis BREUST",
packages=find_packages(),
setup_requires=["cffi>=1.0.0"],
install_requires=[
"cffi>=1.0.0",
"imagequant>=1.0.2",
"mozjpeg-lossless-optimization>=1.0.0",
"pillow>=6.2.2",
"pyguetzli>=1.0.0",
"unidecode>=1.0.0",
"zopflipy>=1.0",
],
extras_require={
"dev": [
"nox",
"flake8",
"black",
"pytest",
"sphinx",
"sphinx-rtd-theme",
"codespell",
]
},
entry_points={
"console_scripts": [
"yoga = yoga.__main__:main",
]
},
cffi_modules=["yoga/model/assimp_build.py:ffibuilder"],
cmdclass={
"build_ext": CustomBuildExt,
},
)