Skip to content

Commit 2a7966c

Browse files
committed
travis: Fix execution of test from source tree setting skbuild platname
Since building the project specifying --plat-name or CMAKE_OSX_* variables leads to different SKBUILD_DIR (e.g "_skbuild/macosx-10.6-x86_64-3.6" vs "_skbuild/macosx-10.11-x86_64-3.6" , the code below attempt to guess the most likely plat-name, extracting the plat-name from the first sub-directory found under "_skbuild" directory.
1 parent 9bc10f9 commit 2a7966c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: cmake/__init__.py

+12
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,21 @@
1010

1111
CMAKE_DATA = os.path.join(os.path.dirname(__file__), 'data')
1212

13+
1314
# Support running tests from the source tree
1415
if not os.path.exists(CMAKE_DATA):
1516
from skbuild.constants import CMAKE_INSTALL_DIR as SKBUILD_CMAKE_INSTALL_DIR
17+
from skbuild.constants import set_skbuild_plat_name
18+
19+
if platform.system().lower() == "darwin":
20+
# Since building the project specifying --plat-name or CMAKE_OSX_* variables
21+
# leads to different SKBUILD_DIR, the code below attempt to guess the most
22+
# likely plat-name.
23+
_skbuild_dirs = os.listdir(os.path.join(os.path.dirname(__file__), '..', '_skbuild'))
24+
if _skbuild_dirs:
25+
_likely_plat_name = '-'.join(_skbuild_dirs[0].split('-')[:3])
26+
set_skbuild_plat_name(_likely_plat_name)
27+
1628
_cmake_data = os.path.abspath(os.path.join(
1729
os.path.dirname(__file__), '..', SKBUILD_CMAKE_INSTALL_DIR(), 'cmake/data'))
1830
if os.path.exists(_cmake_data):

0 commit comments

Comments
 (0)