Hello community, here is the log from the commit of package pam_wrapper for openSUSE:Factory checked in at 2018-02-14 10:51:56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pam_wrapper (Old) and /work/SRC/openSUSE:Factory/.pam_wrapper.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pam_wrapper" Wed Feb 14 10:51:56 2018 rev:5 rq:576310 version:1.0.3 Changes: -------- --- /work/SRC/openSUSE:Factory/pam_wrapper/pam_wrapper.changes 2017-04-11 09:46:49.071056426 +0200 +++ /work/SRC/openSUSE:Factory/.pam_wrapper.new/pam_wrapper.changes 2018-02-14 10:51:57.988939957 +0100 @@ -1,0 +2,11 @@ +Mon Feb 12 11:56:57 UTC 2018 - [email protected] + +- Build python2 and python3 packages +- Added pam_wrapper-1.0.3-build-python2-and-python3-modules.patch + +------------------------------------------------------------------- +Sun Feb 4 09:31:44 UTC 2018 - [email protected] + +- Add missing build require to python-rpm-macros + +------------------------------------------------------------------- New: ---- pam_wrapper-1.0.3-build-python2-and-python3-modules.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pam_wrapper.spec ++++++ --- /var/tmp/diff_new_pack.ub4WuX/_old 2018-02-14 10:51:58.640916492 +0100 +++ /var/tmp/diff_new_pack.ub4WuX/_new 2018-02-14 10:51:58.640916492 +0100 @@ -1,7 +1,7 @@ # # spec file for package pam_wrapper # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -35,12 +35,16 @@ Source0: https://ftp.samba.org/pub/cwrap/%{name}-%{version}.tar.gz Source1: %{name}-rpmlintrc +# PATCH-FIX-UPSTREAM Build python2 and python3 modules if possible +Patch0: pam_wrapper-1.0.3-build-python2-and-python3-modules.patch + BuildRequires: cmake BuildRequires: doxygen BuildRequires: libcmocka-devel BuildRequires: pam-devel -BuildRequires: pkg-config -BuildRequires: python-devel +BuildRequires: python-rpm-macros +BuildRequires: pkgconfig(python2) +BuildRequires: pkgconfig(python3) Recommends: pkg-config Recommends: cmake @@ -88,13 +92,26 @@ %description -n libpamtest-devel-doc Documentation for libpamtest development. -%package -n python-libpamtest +%package -n python2-libpamtest Summary: A python wrapper for libpamtest Group: Development/Libraries/C and C++ Requires: libpamtest0 = %{version}-%{release} Requires: pam_wrapper = %{version}-%{release} +Obsoletes: python-libpamtest +Provides: python-libpamtest -%description -n python-libpamtest +%description -n python2-libpamtest +If you plan to develop python tests for a PAM module, you can use this +library, which simplifies testing of modules. This subpackage includes +the header files for libpamtest + +%package -n python3-libpamtest +Summary: A python wrapper for libpamtest +Group: Development/Libraries/C and C++ +Requires: libpamtest0 = %{version}-%{release} +Requires: pam_wrapper = %{version}-%{release} + +%description -n python3-libpamtest If you plan to develop python tests for a PAM module, you can use this library, which simplifies testing of modules. This subpackage includes the header files for libpamtest @@ -102,6 +119,8 @@ %prep %setup -q +%patch0 -p1 + %build %cmake \ -DUNIT_TESTING=ON @@ -159,8 +178,10 @@ %defattr(-,root,root) %doc build/doc/html -%files -n python-libpamtest -%defattr(-,root,root,-) -%{python_sitearch}/pypamtest.so +%files -n python2-libpamtest +%{python2_sitearch}/pypamtest.so + +%files -n python3-libpamtest +%{python3_sitearch}/pypamtest.so %changelog ++++++ pam_wrapper-1.0.3-build-python2-and-python3-modules.patch ++++++ >From 9beb9f9aaa223864128fd8222f0f92ba8ae697b7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider <[email protected]> Date: Wed, 22 Nov 2017 15:27:44 +0100 Subject: [PATCH 1/2] cmake: Improve PAM_WRAPPER_LOACATION Signed-off-by: Andreas Schneider <[email protected]> Reviewed-by: Ralph Boehme <[email protected]> --- src/CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 713625b..76a87d6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -74,8 +74,4 @@ if (PYTHONLIBS_FOUND) endif() # This needs to be at the end -if (POLICY CMP0026) - cmake_policy(SET CMP0026 OLD) -endif() -get_target_property(PAM_WRAPPER_LOCATION pam_wrapper LOCATION) -set(PAM_WRAPPER_LOCATION ${PAM_WRAPPER_LOCATION} PARENT_SCOPE) +set(PAM_WRAPPER_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}pam_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE) -- 2.16.1 >From 5c36d4284918a3fcc1c58f29f01ca64c65a66fa7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider <[email protected]> Date: Mon, 12 Feb 2018 12:01:22 +0100 Subject: [PATCH 2/2] cmake: Build python2 and python3 modules if possible Signed-off-by: Andreas Schneider <[email protected]> Reviewed-by: Ralph Boehme <[email protected]> --- CMakeLists.txt | 5 ----- src/CMakeLists.txt | 4 +--- src/python/CMakeLists.txt | 15 ++------------- src/python/python2/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ src/python/python3/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ tests/CMakeLists.txt | 29 ++++++++++++++++++++++------- tests/pypamtest_test.py | 5 ++++- 7 files changed, 95 insertions(+), 29 deletions(-) create mode 100644 src/python/python2/CMakeLists.txt create mode 100644 src/python/python3/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index f03a137..af00610 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,11 +46,6 @@ macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source buil set(CMAKE_THREAD_PREFER_PTHREADS ON) find_package(Threads) -find_package(PythonInterp) -set(Python_ADDITIONAL_VERSIONS 2.6 2.7 3.3 3.4 3.6) -find_package(PythonLibs) -find_package(PythonSiteLibs) - # config.h checks include(ConfigureChecks.cmake) configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 76a87d6..e3a1efd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -69,9 +69,7 @@ install(TARGETS pamtest ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) add_subdirectory(modules) -if (PYTHONLIBS_FOUND) - add_subdirectory(python) -endif() +add_subdirectory(python) # This needs to be at the end set(PAM_WRAPPER_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}pam_wrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" PARENT_SCOPE) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index cbee2a6..3394a84 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -1,15 +1,4 @@ project(pypamtest C) -include_directories(${CMAKE_BINARY_DIR}) -include_directories(${pam_wrapper-headers_DIR}) -include_directories(${PYTHON_INCLUDE_DIR}) - -python_add_module(pypamtest pypamtest.c) -target_link_libraries(pypamtest pamtest ${PYTHON_LIBRARY}) - -install( - TARGETS - pypamtest - DESTINATION - ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITELIB} -) +add_subdirectory(python2) +add_subdirectory(python3) diff --git a/src/python/python2/CMakeLists.txt b/src/python/python2/CMakeLists.txt new file mode 100644 index 0000000..faceec3 --- /dev/null +++ b/src/python/python2/CMakeLists.txt @@ -0,0 +1,33 @@ +project(python2-pamtest C) + +unset(PYTHON_EXECUTABLE CACHE) +unset(PYTHON_INCLUDE_DIR CACHE) +unset(PYTHON_LIBRARY CACHE) +unset(PYTHON_SITELIB CACHE) +unset(PYTHONLIBS_FOUND CACHE) +unset(PYTHONLIBS_VERSION_STRING CACHE) + +set(Python_ADDITIONAL_VERSIONS 2.7 2.6) +find_package(PythonLibs) +find_package(PythonInterp) +find_package(PythonSiteLibs) + +if (PYTHONLIBS_FOUND) + set(PYTHON2_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "PYTHON2_EXECUTABLE") + set(PYTHON2_INCLUDE_DIR ${PYTHON_INCLUDE_DIR}) + set(PYTHON2_LIBRARY ${PYTHON_LIBRARY}) + set(PYTHON2_SITELIB ${PYTHON_SITELIB}) + + include_directories(${CMAKE_BINARY_DIR}) + include_directories(${pam_wrapper-headers_DIR}) + include_directories(${PYTHON2_INCLUDE_DIR}) + + python_add_module(python2-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c) + target_link_libraries(python2-pamtest pamtest ${PYTHON2_LIBRARY}) + set_target_properties(python2-pamtest PROPERTIES OUTPUT_NAME "pypamtest") + + install(TARGETS + python2-pamtest + DESTINATION + ${CMAKE_INSTALL_PREFIX}/${PYTHON2_SITELIB}) +endif() diff --git a/src/python/python3/CMakeLists.txt b/src/python/python3/CMakeLists.txt new file mode 100644 index 0000000..1e1599b --- /dev/null +++ b/src/python/python3/CMakeLists.txt @@ -0,0 +1,33 @@ +project(python3-pamtest C) + +unset(PYTHON_EXECUTABLE CACHE) +unset(PYTHON_INCLUDE_DIR CACHE) +unset(PYTHON_LIBRARY CACHE) +unset(PYTHON_SITELIB CACHE) +unset(PYTHONLIBS_FOUND CACHE) +unset(PYTHONLIBS_VERSION_STRING CACHE) + +set(Python_ADDITIONAL_VERSIONS 3.8 3.7 3.6) +find_package(PythonLibs) +find_package(PythonInterp) +find_package(PythonSiteLibs) + +if (PYTHONLIBS_FOUND) + set(PYTHON3_LIBRARY ${PYTHON_LIBRARY}) + set(PYTHON3_INCLUDE_DIR ${PYTHON_INCLUDE_DIR}) + set(PYTHON3_SITELIB ${PYTHON_SITELIB}) + set(PYTHON3_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "PYTHON3_EXECUTABLE") + + include_directories(${CMAKE_BINARY_DIR}) + include_directories(${pam_wrapper-headers_DIR}) + include_directories(${PYTHON3_INCLUDE_DIR}) + + python_add_module(python3-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c) + target_link_libraries(python3-pamtest pamtest ${PYTHON3_LIBRARY}) + set_target_properties(python3-pamtest PROPERTIES OUTPUT_NAME "pypamtest") + + install(TARGETS + python3-pamtest + DESTINATION + ${CMAKE_INSTALL_PREFIX}/${PYTHON3_SITELIB}) +endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 30f0eb2..997c15e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -47,11 +47,26 @@ set_property( PROPERTY ENVIRONMENT ${TEST_ENVIRONMENT}) -if (PYTHONLIBS_FOUND) - add_test(pypamtest_test ${CMAKE_CURRENT_SOURCE_DIR}/pypamtest_test.py) - set_property( - TEST - pypamtest_test - PROPERTY - ENVIRONMENT ${TEST_ENVIRONMENT}) +if (PYTHON2_EXECUTABLE) + add_test(NAME + py2pamtest_test + COMMAND + ${PYTHON2_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pypamtest_test.py) + + set_property(TEST + py2pamtest_test + PROPERTY + ENVIRONMENT ${TEST_ENVIRONMENT}) +endif() + +if (PYTHON3_EXECUTABLE) + add_test(NAME + py3pamtest_test + COMMAND + ${PYTHON3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pypamtest_test.py) + + set_property(TEST + py3pamtest_test + PROPERTY + ENVIRONMENT ${TEST_ENVIRONMENT}) endif() diff --git a/tests/pypamtest_test.py b/tests/pypamtest_test.py index 2c74c0b..32ef65d 100755 --- a/tests/pypamtest_test.py +++ b/tests/pypamtest_test.py @@ -16,7 +16,10 @@ class PyPamTestCase(unittest.TestCase): class PyPamTestImport(unittest.TestCase): def setUp(self): " Make sure we load the in-tree module " - self.modpath = os.path.join(os.getcwd(), "../src/python") + if sys.hexversion >= 0x3000000: + self.modpath = os.path.join(os.getcwd(), "../src/python/python3") + else: + self.modpath = os.path.join(os.getcwd(), "../src/python/python2") self.system_path = sys.path[:] sys.path = [ self.modpath ] -- 2.16.1
