SHA256
1
0
forked from pool/pam_wrapper

Added missing patch entry

OBS-URL: https://build.opensuse.org/package/show/devel:tools/pam_wrapper?expand=0&rev=13
This commit is contained in:
Andreas Schneider 2018-02-13 07:57:41 +00:00 committed by Git OBS Bridge
parent 71e03ed8a9
commit 28225e05e5
2 changed files with 93 additions and 44 deletions

View File

@ -1,45 +1,19 @@
From 9beb9f9aaa223864128fd8222f0f92ba8ae697b7 Mon Sep 17 00:00:00 2001
From 5c36d4284918a3fcc1c58f29f01ca64c65a66fa7 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Wed, 22 Nov 2017 15:27:44 +0100
Subject: [PATCH 1/2] cmake: Improve PAM_WRAPPER_LOACATION
Date: Mon, 12 Feb 2018 12:01:22 +0100
Subject: [PATCH] cmake: Build python2 and python3 modules if possible
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
---
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 84cd3dac56dbcb5815867b02876bb99759aecfd9 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
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 <asn@samba.org>
---
CMakeLists.txt | 5 -----
src/CMakeLists.txt | 4 +---
src/python/CMakeLists.txt | 15 ++-------------
src/python/python2/CMakeLists.txt | 23 +++++++++++++++++++++++
src/python/python3/CMakeLists.txt | 23 +++++++++++++++++++++++
5 files changed, 49 insertions(+), 21 deletions(-)
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
@ -98,13 +72,18 @@ index cbee2a6..3394a84 100644
+add_subdirectory(python3)
diff --git a/src/python/python2/CMakeLists.txt b/src/python/python2/CMakeLists.txt
new file mode 100644
index 0000000..c258d9e
index 0000000..faceec3
--- /dev/null
+++ b/src/python/python2/CMakeLists.txt
@@ -0,0 +1,23 @@
@@ -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)
@ -112,28 +91,38 @@ index 0000000..c258d9e
+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(${PYTHON_INCLUDE_DIR})
+ include_directories(${PYTHON2_INCLUDE_DIR})
+
+ python_add_module(python2-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c)
+ target_link_libraries(python2-pamtest pamtest ${PYTHON_LIBRARY})
+ 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}/${PYTHON_SITELIB})
+ ${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..19a5459
index 0000000..1e1599b
--- /dev/null
+++ b/src/python/python3/CMakeLists.txt
@@ -0,0 +1,23 @@
@@ -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)
@ -141,19 +130,78 @@ index 0000000..19a5459
+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(${PYTHON_INCLUDE_DIR})
+ include_directories(${PYTHON3_INCLUDE_DIR})
+
+ python_add_module(python3-pamtest ${pypamtest_SOURCE_DIR}/pypamtest.c)
+ target_link_libraries(python3-pamtest pamtest ${PYTHON_LIBRARY})
+ 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}/${PYTHON_SITELIB})
+ ${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

View File

@ -2,6 +2,7 @@
Mon Feb 12 11:56:57 UTC 2018 - asn@cryptomilk.org
- 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 - asn@cryptomilk.org