From 6d30c5ddd794b70c6c4dcc57d3a35a7b5951744c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 11 Jun 2019 10:56:12 +0200 Subject: [PATCH] python: make setup.py work even if imported from elsewhere. I feel like I'm stepping into unknown waters here :D --- src/python/setup.py.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/python/setup.py.cmake b/src/python/setup.py.cmake index b4fc8fa..f6992d9 100644 --- a/src/python/setup.py.cmake +++ b/src/python/setup.py.cmake @@ -65,7 +65,13 @@ setup( name='magnum', packages=packages, ext_modules=[Extension(name, sources=[]) for name, path in extension_paths.items() if path], - cmdclass = { + package_dir={ + # Explicitly supply package_dir so importing this file from another + # setup.py (i.e., when this is a bundled dependency of another project) + # does the right thing + '.': os.path.dirname(__file__) + }, + cmdclass={ 'build_ext': TheExtensionIsAlreadyBuiltWhyThisHasToBeSoDamnComplicated }, zip_safe=True