Skip to content

Commit a8cdaec

Browse files
Cleaned up setup.py
1 parent 46863e9 commit a8cdaec

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

setup.py

+6-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from setuptools.command.build_ext import build_ext
99
from distutils.version import LooseVersion
1010

11-
with Path("README.md").open() as readme_file:
11+
with (Path(__file__).resolve().parent / "README.md").open() as readme_file:
1212
long_description = readme_file.read()
1313

1414

@@ -30,31 +30,25 @@ def run(self):
3030
self.build_extension(ext)
3131

3232
def build_extension(self, ext):
33-
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
34-
35-
# required for auto-detection of auxiliary "native" libs
36-
if not extdir.endswith(os.path.sep):
37-
extdir += os.path.sep
33+
ext_dir = Path(self.get_ext_fullpath(ext.name)).parent.resolve()
3834

3935
build_type = os.environ.get("BUILD_TYPE", "Release")
4036
build_args = ["--config", build_type]
4137

4238
cmake_args = [
43-
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + extdir,
39+
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={}/".format(ext_dir),
4440
"-DPYTHON_EXECUTABLE={}".format(sys.executable),
4541
"-DEXAMPLE_VERSION_INFO={}".format(self.distribution.get_version()),
46-
"-DCMAKE_BUILD_TYPE=" + build_type,
47-
"-DUSE_PYTHON_EXTENSION=OFF",
42+
"-DCMAKE_BUILD_TYPE={}".format(build_type),
4843
"-DBUILD_EXAMPLES=OFF",
4944
"-DBUILD_TESTS=OFF",
5045
"-DBUILD_SHARED_LIBS=OFF",
5146
"-DCMAKE_BUILD_WITH_INSTALL_RPATH=TRUE",
52-
"-DCMAKE_INSTALL_RPATH={}".format("$ORIGIN"),
47+
"-DCMAKE_INSTALL_RPATH=$ORIGIN",
5348
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
5449
]
5550

56-
if not os.path.exists(self.build_temp):
57-
os.makedirs(self.build_temp)
51+
Path(self.build_temp).mkdir(exist_ok=True, parents=True)
5852

5953
subprocess.check_call(["cmake", str(Path(".").resolve())] + cmake_args, cwd=self.build_temp)
6054
subprocess.check_call(["cmake", "--build", ".", "--target", "_franky"] + build_args, cwd=self.build_temp)

0 commit comments

Comments
 (0)