forked from buresu/ndi-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
95 lines (87 loc) · 3.4 KB
/
setup.py
File metadata and controls
95 lines (87 loc) · 3.4 KB
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
import os
import shutil
import sys
from pathlib import Path
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
class CMakeExtension(Extension):
def __init__(self, name):
super().__init__(name, sources=[])
class CMakeBuild(build_ext):
def run(self):
# build and install
cwd = os.getcwd()
build_dir = os.path.join(cwd, "build")
os.makedirs(build_dir, exist_ok=True)
os.chdir(build_dir)
install_dir = os.path.join(build_dir, "install")
if not self.dry_run:
cmake_args = [
"cmake",
"..",
"-DCMAKE_INSTALL_PREFIX=%s" % install_dir,
"-DPYTHON_EXECUTABLE=%s" % sys.executable,
]
if "CMAKE_ARGS" in os.environ:
cmake_args += [item for item in os.environ["CMAKE_ARGS"].split(" ") if item]
self.spawn(cmake_args)
if self.debug:
self.spawn(["cmake", "--build", ".", "--config", "Debug", "--target", "install"])
else:
self.spawn(["cmake", "--build", ".", "--config", "Release", "--target", "install"])
os.chdir(cwd)
# move
for ext in self.extensions:
dst_dir = os.path.dirname(self.get_ext_fullpath(ext.name))
lib_dir = os.path.join(dst_dir, "NDIlib")
os.makedirs(lib_dir, exist_ok=True)
files = os.listdir(install_dir)
for filename in files:
filepath = os.path.join(install_dir, filename)
if os.path.isfile(filepath):
shutil.copy(filepath, lib_dir)
# read description
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
# setup
setup(
name="ndi-python",
version="5.1.1.5",
description="Wrapper package for NDI SDK python bindings.",
long_description=long_description,
long_description_content_type="text/markdown",
author="Naoto Kondo <cgigcp3yqt@gmail.com>",
url="https://github.com/buresu/ndi-python",
license="MIT",
python_requires=">=3.7",
install_requires=["numpy", "pybind11"],
ext_modules=[CMakeExtension("NDIlib")],
cmdclass={"build_ext": CMakeBuild},
packages=["NDIlib"],
package_data={"NDIlib": ["*.so*", "*.pyd", "*.dll", "*.dylib", "*.txt", "*.pyi", "*.typed"]},
zip_safe=False,
keywords=["NDI", "NewTek", "Video Production"],
classifiers=[
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: C++",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Multimedia",
"Topic :: Multimedia :: Graphics",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Video",
"Topic :: System :: Networking",
],
)