yoga/setup.py

123 lines
3.5 KiB
Python
Raw Normal View History

2017-12-08 10:33:10 +01:00
#!/usr/bin/env python
# encoding: UTF-8
import os
2018-01-17 09:35:03 +01:00
import subprocess
2017-12-08 10:33:10 +01:00
from setuptools import setup, find_packages
from setuptools.command.build_ext import build_ext
2018-01-17 09:35:03 +01:00
2020-04-08 16:53:08 +02:00
def _find_msbuild(plat_spec="x64"):
from setuptools import msvc
2021-03-29 13:46:56 +02:00
vc_env = msvc.msvc14_get_vc_env(plat_spec)
2020-04-08 16:53:08 +02:00
if "vsinstalldir" not in vc_env:
raise Exception("Unable to find any Visual Studio installation")
2021-03-29 13:46:56 +02:00
return os.path.join(
vc_env["vsinstalldir"], "MSBuild", "Current", "Bin", "MSBuild.exe"
)
2020-04-08 16:53:08 +02:00
class CustomBuildExt(build_ext):
def build_extensions(self):
2020-04-08 16:53:08 +02:00
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", ""
)
2021-03-29 13:46:56 +02:00
subprocess.call(
[
"cmake",
"..",
"-DBUILD_SHARED_LIBS=OFF",
"-DASSIMP_BUILD_ASSIMP_TOOLS=OFF",
"-DASSIMP_BUILD_TESTS=OFF",
"-DASSIMP_BUILD_ZLIB=ON",
]
)
2020-04-08 16:53:08 +02:00
subprocess.call(["make"])
elif self.compiler.compiler_type == "msvc":
2020-04-08 16:53:08 +02:00
msbuild = _find_msbuild()
2021-03-29 13:46:56 +02:00
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"]
)
2020-04-08 16:53:08 +02:00
else:
raise Exception("Unsupported platform")
2020-04-08 16:53:08 +02:00
os.chdir("../..")
build_ext.build_extensions(self)
2017-12-08 10:33:10 +01:00
long_description = ""
if os.path.isfile("README.rst"):
long_description = open("README.rst", "r").read()
setup(
name="yoga",
2024-01-07 11:57:21 +01:00
version="1.3.1",
2017-12-08 10:33:10 +01:00
description="Yummy Optimizer for Gorgeous Assets",
url="https://github.com/wanadev/yoga",
2022-10-29 13:20:52 +02:00
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",
},
2017-12-08 10:33:10 +01:00
license="BSD-3-Clause",
long_description=long_description,
2021-04-16 10:17:47 +02:00
keywords="image webp jpeg png optimizer guetzli zopfli zopflipng libwebp 3d model mesh assimp gltf glb converter",
2017-12-08 10:33:10 +01:00
author="Wanadev",
author_email="contact@wanadev.fr",
maintainer="Fabien LOISON, Alexis BREUST",
packages=find_packages(),
setup_requires=["cffi>=1.0.0"],
install_requires=[
"cffi>=1.0.0",
2022-05-09 15:50:11 +02:00
"imagequant>=1.0.2",
2021-08-09 10:58:11 +02:00
"mozjpeg-lossless-optimization>=1.0.0",
2020-03-30 10:45:00 +02:00
"pillow>=6.2.2",
2017-12-08 10:33:10 +01:00
"pyguetzli>=1.0.0",
2018-05-09 09:50:13 +02:00
"unidecode>=1.0.0",
2021-03-29 13:46:56 +02:00
"zopflipy>=1.0",
],
2019-02-22 16:32:57 +01:00
extras_require={
"dev": [
"nox",
2019-02-22 16:32:57 +01:00
"flake8",
"black",
"pytest",
2022-10-15 11:12:10 +02:00
"sphinx",
2019-02-22 16:32:57 +01:00
"sphinx-rtd-theme",
2022-10-15 11:12:10 +02:00
"codespell",
2021-03-29 13:46:56 +02:00
]
},
2018-01-15 16:23:07 +01:00
entry_points={
"console_scripts": [
2021-03-29 13:46:56 +02:00
"yoga = yoga.__main__:main",
]
},
2018-01-18 11:04:07 +01:00
cffi_modules=["yoga/model/assimp_build.py:ffibuilder"],
2018-01-17 09:35:03 +01:00
cmdclass={
"build_ext": CustomBuildExt,
2021-03-29 13:46:56 +02:00
},
)