This is an automated email from the ASF dual-hosted git repository.
astitcher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
The following commit(s) were added to refs/heads/main by this push:
new a920192 PROTON-2526/PROTON-2527: [Python,ruby] Don't install without
SYSINSTALL_BINDINGS
a920192 is described below
commit a920192ab29e2845134fd340bf230f223f837243
Author: Andrew Stitcher <[email protected]>
AuthorDate: Thu Mar 31 18:17:48 2022 -0400
PROTON-2526/PROTON-2527: [Python,ruby] Don't install without
SYSINSTALL_BINDINGS
As we now make both the python package and the ruby gem as part of the
build we don't need to install anything in the install area by default.
- Also remove a long deprecated use of Python distutils
---
CMakeLists.txt | 2 +-
python/CMakeLists.txt | 77 +++++++++++++++++++++++++--------------------------
ruby/CMakeLists.txt | 15 +++++-----
3 files changed, 46 insertions(+), 48 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 78bb935..a0ca897 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -296,7 +296,7 @@ pn_relative_install_dir (LIBDIR "${CMAKE_INSTALL_PREFIX}"
"${LIB_INSTALL_DIR}")
# system specified locations.
set (BINDINGS_DIR ${LIB_INSTALL_DIR}/proton/bindings)
-set (SYSINSTALL_BINDINGS OFF CACHE BOOL "If SYSINSTALL_BINDINGS is OFF then
proton bindings will be installed underneath ${BINDINGS_DIR} and each user will
need to modify their interpreter configuration to load the appropriate binding.
If SYSINSTALL_BINDINGS is ON, then each language interpreter will be queried
for the appropriate directory and proton bindings will be installed and
available system wide with no additional per user configuration.")
+set (SYSINSTALL_BINDINGS OFF CACHE BOOL "If SYSINSTALL_BINDINGS is ON, then
each language interpreter will be queried for the appropriate directory and
proton bindings will be installed in that location.")
set (BINDING_LANGS PYTHON RUBY)
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 06caf61..cedac4d 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -46,19 +46,6 @@ set_target_properties(${SWIG_MODULE_cproton_REAL_NAME}
PROPERTIES
LINK_FLAGS "${CATCH_UNDEFINED}")
-if (CHECK_SYSINSTALL_PYTHON)
- execute_process(COMMAND ${Python_EXECUTABLE}
- -c "from distutils.sysconfig import get_python_lib;
print(get_python_lib(True))"
- OUTPUT_VARIABLE PYTHON_SITEARCH_PACKAGES_DEFAULT
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-else ()
- set (PYTHON_SITEARCH_PACKAGES_DEFAULT ${BINDINGS_DIR}/python)
-endif ()
-
-if (NOT PYTHON_SITEARCH_PACKAGES)
- set (PYTHON_SITEARCH_PACKAGES ${PYTHON_SITEARCH_PACKAGES_DEFAULT})
-endif()
-
set (pysrc-generated cproton.py)
set (pysrc
proton/__init__.py
@@ -100,21 +87,6 @@ set(py_dist_files
docs/tutorial.rst
)
-macro (py_compile directory files artifacts)
- foreach (src_file ${files})
- install(CODE "execute_process(COMMAND \"${Python_EXECUTABLE}\" -c \"import
py_compile; py_compile.compile('${src_file}', cfile='${src_file}c')\"
- WORKING_DIRECTORY ${directory})")
- install(CODE "execute_process(COMMAND \"${Python_EXECUTABLE}\" -O -c
\"import py_compile; py_compile.compile('${src_file}', cfile='${src_file}o')\"
- WORKING_DIRECTORY ${directory})")
- list(APPEND ${artifacts} ${directory}/${src_file}
- ${directory}/${src_file}c
- ${directory}/${src_file}o)
- endforeach (src_file)
-endmacro(py_compile)
-
-py_compile(${CMAKE_CURRENT_BINARY_DIR} ${pysrc-generated} CPROTON_ARTIFACTS)
-py_compile(${CMAKE_CURRENT_SOURCE_DIR} "${pysrc}" PROTON_ARTIFACTS)
-
# Sphinx documentation
check_python_module("sphinx" SPHINX_MODULE_FOUND)
if (NOT SPHINX_MODULE_FOUND)
@@ -130,24 +102,51 @@ else ()
DESTINATION "${PROTON_SHARE}/docs/api-py"
COMPONENT documentation
OPTIONAL)
+ set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES docs)
endif ()
-install(FILES ${CPROTON_ARTIFACTS}
- DESTINATION ${PYTHON_SITEARCH_PACKAGES}
- COMPONENT Python)
-install(FILES ${PROTON_ARTIFACTS}
- DESTINATION "${PYTHON_SITEARCH_PACKAGES}/proton/"
- COMPONENT Python)
-install(TARGETS ${SWIG_MODULE_cproton_REAL_NAME}
- DESTINATION ${PYTHON_SITEARCH_PACKAGES}
- COMPONENT Python)
+if (CHECK_SYSINSTALL_PYTHON)
+ execute_process(COMMAND ${Python_EXECUTABLE}
+ -c "from sysconfig import get_path; print(get_path('platlib'))"
+ OUTPUT_VARIABLE PYTHON_SITEARCH_PACKAGES_DEFAULT
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if (NOT PYTHON_SITEARCH_PACKAGES)
+ set (PYTHON_SITEARCH_PACKAGES ${PYTHON_SITEARCH_PACKAGES_DEFAULT})
+ endif()
+
+ macro (py_compile directory files artifacts)
+ foreach (src_file ${files})
+ install(CODE "execute_process(COMMAND \"${Python_EXECUTABLE}\" -c
\"import py_compile; py_compile.compile('${src_file}', cfile='${src_file}c')\"
+ WORKING_DIRECTORY ${directory})")
+ install(CODE "execute_process(COMMAND \"${Python_EXECUTABLE}\" -O -c
\"import py_compile; py_compile.compile('${src_file}', cfile='${src_file}o')\"
+ WORKING_DIRECTORY ${directory})")
+ list(APPEND ${artifacts} ${directory}/${src_file}
+ ${directory}/${src_file}c
+ ${directory}/${src_file}o)
+ endforeach (src_file)
+ endmacro(py_compile)
+
+ py_compile(${CMAKE_CURRENT_BINARY_DIR} ${pysrc-generated} CPROTON_ARTIFACTS)
+ py_compile(${CMAKE_CURRENT_SOURCE_DIR} "${pysrc}" PROTON_ARTIFACTS)
+
+ install(FILES ${CPROTON_ARTIFACTS}
+ DESTINATION ${PYTHON_SITEARCH_PACKAGES}
+ COMPONENT Python)
+ install(FILES ${PROTON_ARTIFACTS}
+ DESTINATION "${PYTHON_SITEARCH_PACKAGES}/proton/"
+ COMPONENT Python)
+ install(TARGETS ${SWIG_MODULE_cproton_REAL_NAME}
+ DESTINATION ${PYTHON_SITEARCH_PACKAGES}
+ COMPONENT Python)
+endif ()
+
+# Install python examples even without a 'sysinstall' python
install(DIRECTORY examples/
DESTINATION "${PROTON_SHARE}/examples/python"
COMPONENT Python
USE_SOURCE_PERMISSIONS)
-set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES docs)
-
#
# Set up the directory 'dist' for building the python native package
# source distribution for Pypi/pip
diff --git a/ruby/CMakeLists.txt b/ruby/CMakeLists.txt
index 9dd7bc7..178b87b 100644
--- a/ruby/CMakeLists.txt
+++ b/ruby/CMakeLists.txt
@@ -99,16 +99,15 @@ if (CHECK_SYSINSTALL_RUBY)
endif()
set(RUBY_ARCHLIB_DIR_DEFAULT "${OUTPUT_RUBY_ARCHLIB_DIR}")
-else (CHECK_SYSINSTALL_RUBY)
- set (RUBY_ARCHLIB_DIR_DEFAULT ${BINDINGS_DIR}/ruby)
-endif (CHECK_SYSINSTALL_RUBY)
-if (NOT RUBY_ARCHLIB_DIR)
- set (RUBY_ARCHLIB_DIR ${RUBY_ARCHLIB_DIR_DEFAULT})
-endif()
+ if (NOT RUBY_ARCHLIB_DIR)
+ set (RUBY_ARCHLIB_DIR ${RUBY_ARCHLIB_DIR_DEFAULT})
+ endif()
+
+ install(TARGETS cproton-ruby DESTINATION ${RUBY_ARCHLIB_DIR} COMPONENT Ruby)
+ install(DIRECTORY lib/ DESTINATION ${RUBY_ARCHLIB_DIR} COMPONENT Ruby)
+endif (CHECK_SYSINSTALL_RUBY)
-install(TARGETS cproton-ruby DESTINATION ${RUBY_ARCHLIB_DIR} COMPONENT Ruby)
-install(DIRECTORY lib/ DESTINATION ${RUBY_ARCHLIB_DIR} COMPONENT Ruby)
install(DIRECTORY examples/
DESTINATION "${PROTON_SHARE}/examples/ruby"
COMPONENT Ruby
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]