From: Kefu Chai Date: Tue, 20 Nov 2018 14:13:35 +0000 (+0800) Subject: cmake: do not pass unnecessary param to setup.py X-Git-Tag: v14.1.0~829^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ebfa2df2d55f2ee6fdadb49fd1afc2585864f725;p=ceph-ci.git cmake: do not pass unnecessary param to setup.py --single-version-externally-managed is used for packaging python eggs to deb. so the metadata can be stored in the egg, and can be accessed by user if necessary, see [1]. but this does not apply to users who just want to "make install" without packaging Ceph. the problem is, if we pass --single-version-externally-managed to setup.py, we need to pass --record or --root also. otherwise setuptools complains: error: You must specify --record or --root when building system packages so in this change, we choose not to pass "--single-version-externally-managed", unless $DESTDIR is set. both "ceph.spec.in" and "debian/rules" set $DESTDIR when running "make install". so we can always check $DESTDIR to tell if current "make install" is launched by the packaging script or not. this might not be accurate, but good enough. assuming enduser does not use DESTDIR when running plain "make install". -- [1] https://wiki.debian.org/Python/FAQ#How_should_we_package_Python_eggs.3F Signed-off-by: Kefu Chai --- diff --git a/cmake/modules/Distutils.cmake b/cmake/modules/Distutils.cmake index 69519a7316a..272bd10fa70 100644 --- a/cmake/modules/Distutils.cmake +++ b/cmake/modules/Distutils.cmake @@ -20,14 +20,16 @@ function(distutils_install_module name) if(EXISTS /etc/debian_version) list(APPEND options --install-layout=deb) endif() - list(APPEND options --root=\$ENV{DESTDIR}) + list(APPEND options + --root=\$ENV{DESTDIR} + --single-version-externally-managed) if(NOT \"${DU_INSTALL_SCRIPT}\" STREQUAL \"\") list(APPEND options --install-script=${DU_INSTALL_SCRIPT}) endif() endif() execute_process( COMMAND ${PYTHON${PYTHON_VERSION}_EXECUTABLE} - setup.py install \${options} --single-version-externally-managed + setup.py install \${options} WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")") endfunction(distutils_install_module)