Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/MacroASN1Module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ macro(add_asn1_module _modulename _groupname)
# Generate the module file in <quick-der/modulename.h>
# and python/testing/modulename.py
# and install the header file to include/quick-der/modulename.h.
AppendToPythonPath (_ppath ${CMAKE_SOURCE_DIR}/python)
set (_ppath ${_ppath} ${CMAKE_SOURCE_DIR}/python)
add_custom_command (OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/quick-der/${_modulename}.h
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${_ppath} ${PYTHON_EXECUTABLE} ${_qd_asn2quickder} -l c ${asn1module_asn2quickder_options} ${CMAKE_CURRENT_SOURCE_DIR}/${_modulename}.asn1
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_modulename}.asn1
Expand Down
30 changes: 0 additions & 30 deletions cmake/PythonSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,6 @@
# SPDX-License-Identifier: BSD-2-Clause.degroot
# License-Filename: LICENSES/BSD-2-Clause.degroot

# Not using WIN32 here, because that's set when the **target** system
# is Windows. Here, we need it while building, regardless of target,
# on a Windows host.
if (CMAKE_HOST_SYSTEM MATCHES "Windows")
set (PYTHON_PATH_SEPARATOR ";")
else()
set (PYTHON_PATH_SEPARATOR ":")
endif()

# Sets @p VARNAME to the value of the environment-variable PYTHONPATH,
# with @p path appended to it with a suitable separator. If more than
# one value is passed in, they are all appended with suitable separators.
#
# This **could** be generalized, to use a different ENV variable.
function (AppendToPythonPath VARNAME path)
set (_ppath $ENV{PYTHONPATH})
# Special-case if the existing environment variable is empty.
if (NOT _ppath)
set (_ppath ${path})
else()
set (_ppath "${_ppath}${PYTHON_PATH_SEPARATOR}${path}")
endif()
# And append all the rest.
foreach (a ${ARGN})
set (_ppath "${_ppath}${PYTHON_PATH_SEPARATOR}${a}")
endforeach()

set (${VARNAME} "${_ppath}" PARENT_SCOPE)
endfunction()

# Find a Python3 interpreter. This is a flimsy wrapper around find_package,
# and only sets PYTHON_FOUND and PYTHON_EXECUTABLE, as the old-fashioned way.
macro (FindPythonInterpreter)
Expand Down
11 changes: 6 additions & 5 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ if (NOT NO_TESTING)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()

AppendToPythonPath (_ppath
${CMAKE_CURRENT_SOURCE_DIR}/silly1
${CMAKE_CURRENT_SOURCE_DIR}/sully2
set (_ppath
${_ppath}
"${CMAKE_CURRENT_SOURCE_DIR}/silly 1"
"${CMAKE_CURRENT_SOURCE_DIR}/sully 2"
)
add_custom_target(ppath_test
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${_ppath}
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/ppathtest.py
COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=$<SHELL_PATH:${_ppath}>"
$<SHELL_PATH:${PYTHON_EXECUTABLE}> $<SHELL_PATH:${CMAKE_CURRENT_SOURCE_DIR}/ppathtest.py>
)
add_custom_target(ppath_notest
COMMAND ${CMAKE_COMMAND} -E env
Expand Down
File renamed without changes.
File renamed without changes.