1
1
import os
2
2
import shutil
3
+ import sys
3
4
from pathlib import Path
4
- from setuptools import setup , Extension
5
+
6
+ from setuptools import Extension , setup
5
7
from setuptools .command .build_ext import build_ext
6
8
7
9
@@ -14,28 +16,29 @@ class CMakeBuild(build_ext):
14
16
def run (self ):
15
17
# build and install
16
18
cwd = os .getcwd ()
17
- build_dir = os .path .join (cwd , ' build' )
19
+ build_dir = os .path .join (cwd , " build" )
18
20
os .makedirs (build_dir , exist_ok = True )
19
21
os .chdir (build_dir )
20
- install_dir = os .path .join (build_dir , ' install' )
22
+ install_dir = os .path .join (build_dir , " install" )
21
23
if not self .dry_run :
22
- cmake_args = ['cmake' , '..' ,
23
- '-DCMAKE_INSTALL_PREFIX=%s' % install_dir ]
24
+ cmake_args = [
25
+ "cmake" ,
26
+ ".." ,
27
+ "-DCMAKE_INSTALL_PREFIX=%s" % install_dir ,
28
+ "-DPYTHON_EXECUTABLE=%s" % sys .executable ,
29
+ ]
24
30
if "CMAKE_ARGS" in os .environ :
25
- cmake_args += [
26
- item for item in os .environ ["CMAKE_ARGS" ].split (" " ) if item ]
31
+ cmake_args += [item for item in os .environ ["CMAKE_ARGS" ].split (" " ) if item ]
27
32
self .spawn (cmake_args )
28
33
if self .debug :
29
- self .spawn (['cmake' , '--build' , '.' , '--config' ,
30
- 'Debug' , '--target' , 'install' ])
34
+ self .spawn (["cmake" , "--build" , "." , "--config" , "Debug" , "--target" , "install" ])
31
35
else :
32
- self .spawn (['cmake' , '--build' , '.' , '--config' ,
33
- 'Release' , '--target' , 'install' ])
36
+ self .spawn (["cmake" , "--build" , "." , "--config" , "Release" , "--target" , "install" ])
34
37
os .chdir (cwd )
35
38
# move
36
39
for ext in self .extensions :
37
40
dst_dir = os .path .dirname (self .get_ext_fullpath (ext .name ))
38
- lib_dir = os .path .join (dst_dir , ' NDIlib' )
41
+ lib_dir = os .path .join (dst_dir , " NDIlib" )
39
42
os .makedirs (lib_dir , exist_ok = True )
40
43
files = os .listdir (install_dir )
41
44
for filename in files :
@@ -50,43 +53,43 @@ def run(self):
50
53
51
54
# setup
52
55
setup (
53
- name = ' ndi-python' ,
54
- version = ' 5.1.1.5' ,
55
- description = ' Wrapper package for NDI SDK python bindings.' ,
56
+ name = " ndi-python" ,
57
+ version = " 5.1.1.5" ,
58
+ description = " Wrapper package for NDI SDK python bindings." ,
56
59
long_description = long_description ,
57
- long_description_content_type = ' text/markdown' ,
58
- author = ' Naoto Kondo <[email protected] >' ,
59
- url = ' https://github.com/buresu/ndi-python' ,
60
+ long_description_content_type = " text/markdown" ,
61
+ author = " Naoto Kondo <[email protected] >" ,
62
+ url = " https://github.com/buresu/ndi-python" ,
60
63
license = "MIT" ,
61
- python_requires = ' >=3.7' ,
62
- install_requires = [' numpy' ],
63
- ext_modules = [CMakeExtension (' NDIlib' )],
64
- cmdclass = {' build_ext' : CMakeBuild },
65
- packages = [' NDIlib' ],
66
- package_data = {' NDIlib' : [' *.so*' , ' *.pyd' , ' *.dll' , ' *.dylib' , ' *.txt' ]},
64
+ python_requires = " >=3.7" ,
65
+ install_requires = [" numpy" ],
66
+ ext_modules = [CMakeExtension (" NDIlib" )],
67
+ cmdclass = {" build_ext" : CMakeBuild },
68
+ packages = [" NDIlib" ],
69
+ package_data = {" NDIlib" : [" *.so*" , " *.pyd" , " *.dll" , " *.dylib" , " *.txt" ]},
67
70
zip_safe = False ,
68
- keywords = [' NDI' , ' NewTek' , ' Video Production' ],
71
+ keywords = [" NDI" , " NewTek" , " Video Production" ],
69
72
classifiers = [
70
- ' Intended Audience :: Developers' ,
71
- ' License :: OSI Approved :: MIT License' ,
72
- ' Operating System :: MacOS' ,
73
- ' Operating System :: Microsoft :: Windows' ,
74
- ' Operating System :: POSIX :: Linux' ,
75
- ' Programming Language :: C++' ,
76
- ' Programming Language :: Python' ,
77
- ' Programming Language :: Python :: 3' ,
78
- ' Programming Language :: Python :: 3 :: Only' ,
79
- ' Programming Language :: Python :: 3.7' ,
80
- ' Programming Language :: Python :: 3.8' ,
81
- ' Programming Language :: Python :: 3.9' ,
82
- ' Programming Language :: Python :: 3.10' ,
83
- ' Programming Language :: Python :: Implementation :: CPython' ,
84
- ' Topic :: Software Development' ,
85
- ' Topic :: Software Development :: Libraries' ,
86
- ' Topic :: Multimedia' ,
87
- ' Topic :: Multimedia :: Graphics' ,
88
- ' Topic :: Multimedia :: Sound/Audio' ,
89
- ' Topic :: Multimedia :: Video' ,
90
- ' Topic :: System :: Networking' ,
73
+ " Intended Audience :: Developers" ,
74
+ " License :: OSI Approved :: MIT License" ,
75
+ " Operating System :: MacOS" ,
76
+ " Operating System :: Microsoft :: Windows" ,
77
+ " Operating System :: POSIX :: Linux" ,
78
+ " Programming Language :: C++" ,
79
+ " Programming Language :: Python" ,
80
+ " Programming Language :: Python :: 3" ,
81
+ " Programming Language :: Python :: 3 :: Only" ,
82
+ " Programming Language :: Python :: 3.7" ,
83
+ " Programming Language :: Python :: 3.8" ,
84
+ " Programming Language :: Python :: 3.9" ,
85
+ " Programming Language :: Python :: 3.10" ,
86
+ " Programming Language :: Python :: Implementation :: CPython" ,
87
+ " Topic :: Software Development" ,
88
+ " Topic :: Software Development :: Libraries" ,
89
+ " Topic :: Multimedia" ,
90
+ " Topic :: Multimedia :: Graphics" ,
91
+ " Topic :: Multimedia :: Sound/Audio" ,
92
+ " Topic :: Multimedia :: Video" ,
93
+ " Topic :: System :: Networking" ,
91
94
],
92
95
)
0 commit comments