Skip to content

Commit

Permalink
Remove obsolete Python guard
Browse files Browse the repository at this point in the history
The Python guard isn't necessary anymore because submodules are
now installed in the Python package espressomd, and the testsuite
itself already has a Python guard in the top-level CMakeLists.txt.
  • Loading branch information
jngrad committed Oct 17, 2019
1 parent 5f3fcb0 commit 1af7b0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
13 changes: 5 additions & 8 deletions testsuite/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@ function(CMAKE_TEST)
set(cmake_tests ${cmake_tests} ${TEST_FILE} PARENT_SCOPE)
endfunction(CMAKE_TEST)

if(WITH_PYTHON AND PYTHONINTERP_FOUND)
# obtain Python*_SITEARCH without find_package(Python*)
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c "from distutils import sysconfig as sc;print(sc.get_python_lib(prefix='', plat_specific=True, standard_lib=False))"
OUTPUT_VARIABLE Python_SITEARCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c "from distutils import sysconfig as sc;print(sc.get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}', plat_specific=True, standard_lib=False))"
OUTPUT_VARIABLE PYTHON_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)

cmake_test(FILE test_install.sh DEPENDENCIES BashUnitTests.sh)
endif()
cmake_test(FILE test_install.sh DEPENDENCIES BashUnitTests.sh)

add_custom_target(setup_install COMMAND make install WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_custom_target(check_cmake_install COMMAND ${CMAKE_CTEST_COMMAND} --timeout ${TEST_TIMEOUT} -C serial --output-on-failure)
Expand Down
10 changes: 4 additions & 6 deletions testsuite/cmake/test_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@ source BashUnitTests.sh

# test installation and Python bindings
function test_install() {
local -r site_package_espressomd="$(realpath '@CMAKE_INSTALL_PREFIX@/@Python_SITEARCH@/espressomd')"

# check Python files were installed in espressomd
local -r filepaths=("@CMAKE_INSTALL_FULL_BINDIR@/pypresso" \
"${site_package_espressomd}/EspressoCore.so" \
"${site_package_espressomd}/_init.so" \
"${site_package_espressomd}/__init__.py"
"@PYTHON_DIR@/espressomd/EspressoCore.so" \
"@PYTHON_DIR@/espressomd/_init.so" \
"@PYTHON_DIR@/espressomd/__init__.py"
)
for filepath in ${filepaths[@]}; do
assert_file_exists "${filepath}"
done

# check no Python file was installed outside espressomd
paths=$(find "@CMAKE_INSTALL_PREFIX@" -path "${site_package_espressomd}" -prune -o \( -name '*.py' -o -name '*.so' \) -print)
paths=$(find "@CMAKE_INSTALL_PREFIX@" -path "@PYTHON_DIR@/espressomd" -prune -o \( -name '*.py' -o -name '*.so' \) -print)
count=$(echo "${paths}" | wc -l)
assert_string_equal "${paths}" "" "${count} files were installed in the wrong directories:"$'\n'"${paths}"

Expand Down

0 comments on commit 1af7b0d

Please sign in to comment.