Skip to content

Commit a1523c4

Browse files
committed
Pass -DPYTHON_EXECUTABLE to cmake
buresu#25
1 parent 5dd861e commit a1523c4

File tree

1 file changed

+49
-46
lines changed

1 file changed

+49
-46
lines changed

setup.py

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import os
22
import shutil
3+
import sys
34
from pathlib import Path
4-
from setuptools import setup, Extension
5+
6+
from setuptools import Extension, setup
57
from setuptools.command.build_ext import build_ext
68

79

@@ -14,28 +16,29 @@ class CMakeBuild(build_ext):
1416
def run(self):
1517
# build and install
1618
cwd = os.getcwd()
17-
build_dir = os.path.join(cwd, 'build')
19+
build_dir = os.path.join(cwd, "build")
1820
os.makedirs(build_dir, exist_ok=True)
1921
os.chdir(build_dir)
20-
install_dir = os.path.join(build_dir, 'install')
22+
install_dir = os.path.join(build_dir, "install")
2123
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+
]
2430
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]
2732
self.spawn(cmake_args)
2833
if self.debug:
29-
self.spawn(['cmake', '--build', '.', '--config',
30-
'Debug', '--target', 'install'])
34+
self.spawn(["cmake", "--build", ".", "--config", "Debug", "--target", "install"])
3135
else:
32-
self.spawn(['cmake', '--build', '.', '--config',
33-
'Release', '--target', 'install'])
36+
self.spawn(["cmake", "--build", ".", "--config", "Release", "--target", "install"])
3437
os.chdir(cwd)
3538
# move
3639
for ext in self.extensions:
3740
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")
3942
os.makedirs(lib_dir, exist_ok=True)
4043
files = os.listdir(install_dir)
4144
for filename in files:
@@ -50,43 +53,43 @@ def run(self):
5053

5154
# setup
5255
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.",
5659
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",
6063
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"]},
6770
zip_safe=False,
68-
keywords=['NDI', 'NewTek', 'Video Production'],
71+
keywords=["NDI", "NewTek", "Video Production"],
6972
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",
9194
],
9295
)

0 commit comments

Comments
 (0)