#4075 BUILD: Prefer python3 for intgcheck
Closed 4 years ago by pbrezina. Opened 4 years ago by lslebodn.
SSSD/ lslebodn/sssd intg_py3  into  master

file modified
+3 -5
@@ -322,7 +322,7 @@ 

  AS_IF([test x$HAVE_PYTHON3 = xyes],

        [AC_PATH_PROG(PYTHON3, python3)])

  

- if test x$HAVE_PYTHON2_BINDINGS = x1; then

+ if test x$HAVE_PYTHON2_BINDINGS = xyes; then

      AS_IF([test x$HAVE_PYTHON2 != xyes],

            [AC_MSG_ERROR([

  The program python2 was not found in search path.
@@ -348,7 +348,7 @@ 

      SSS_CLEAN_PYTHON_VARIABLES

  fi

  

- if test x$HAVE_PYTHON3_BINDINGS = x1; then

+ if test x$HAVE_PYTHON3_BINDINGS = xyes; then

      AS_IF([test x$HAVE_PYTHON3 != xyes],

            [AC_MSG_ERROR([

  The program python3 was not found in search path.
@@ -374,7 +374,7 @@ 

      SSS_CLEAN_PYTHON_VARIABLES

  fi

  

- if test x$HAVE_PYTHON3_BINDINGS = x1; then

+ if test x$HAVE_PYTHON3_BINDINGS = xyes; then

      PYTHON_EXEC=$PYTHON3

  else

      PYTHON_EXEC=$PYTHON2
@@ -385,8 +385,6 @@ 

                 [test x"$with_python2_bindings" = xyes \

                       -o x"$with_python3_bindings" = xyes])

  

- AM_PYTHON2_MODULE([ldap])

- 

  if test x$HAVE_SELINUX != x; then

      AM_CHECK_SELINUX

  fi

file modified
+15 -6
@@ -40,10 +40,6 @@ 

          nss_wrapper

          openldap-clients

          openldap-servers

-         pytest

-         python-ldap

-         python-psutil

-         pyldb

          rpm-build

          uid_wrapper

          pam_wrapper
@@ -51,16 +47,29 @@ 

          curl-devel

          krb5-server

          krb5-workstation

-         dbus-python

      )

  

-     if [[ "$DISTRO_BRANCH" == -redhat-fedora-3[1-9]* ]]; then

+     if [[ "$DISTRO_BRANCH" == -redhat-fedora-3[1-9]* ||

+           "$DISTRO_BRANCH" == -redhat-redhatenterprise*-8.*- ||

+           "$DISTRO_BRANCH" == -redhat-centos-8.*- ]]; then

          DEPS_LIST+=(

+             python3-dbus

+             python3-ldap

+             python3-ldb

+             python3-psutil

              python3-pycodestyle

+             python3-pytest

+             python3-requests

          )

      else

          DEPS_LIST+=(

+             dbus-python

+             pyldb

+             pytest

+             python-ldap

              python-pep8

+             python-psutil

+             python-requests

          )

      fi

  

file modified
+2 -2
@@ -383,7 +383,7 @@ 

                  [with_python2_bindings=yes]

                 )

      if test x"$with_python2_bindings" = xyes; then

-         AC_SUBST([HAVE_PYTHON2_BINDINGS], [1])

+         AC_SUBST([HAVE_PYTHON2_BINDINGS], [yes])

          AC_DEFINE_UNQUOTED([HAVE_PYTHON2_BINDINGS], [1],

                             [Build with python2 bindings])

      fi
@@ -400,7 +400,7 @@ 

                  [with_python3_bindings=yes]

                 )

      if test x"$with_python3_bindings" = xyes; then

-         AC_SUBST([HAVE_PYTHON3_BINDINGS], [1])

+         AC_SUBST([HAVE_PYTHON3_BINDINGS], [yes])

          AC_DEFINE_UNQUOTED([HAVE_PYTHON3_BINDINGS], [1],

                             [Build with python3 bindings])

      fi

file modified
+63 -10
@@ -1,11 +1,5 @@ 

  AC_CHECK_PROG([HAVE_FAKEROOT], [fakeroot], [yes], [no])

  

- dnl Check for pytest binary. When available, we will use py.test-2 for python2

- dnl version. If it is not available we will try to use py.test.

- AC_PATH_PROG([PYTEST], [py.test])

- AC_PATH_PROG([PYTEST2], [py.test-2], [$PYTEST])

- AS_IF([test -n "$PYTEST2"], [HAVE_PYTEST2=yes], [HAVE_PYTEST2=no])

- 

  dnl Check for variable and fail unless value is "yes"

  dnl The second argument will be printed in error message in case of error

  dnl Usage:
@@ -16,6 +10,62 @@ 

            AC_MSG_ERROR([cannot enable integration tests: $2 not found])])

  ])

  

+ dnl Check for python variable and fail/warn unless value is "yes"

+ dnl The second argument will be printed in error message in case of error

+ dnl Any value in 3rd argument will make change error to info

+ dnl Usage:

+ dnl     SSS_INTGCHECK_PYTHON_REQ(variable, message, [non_fatal])

+ 

+ AC_DEFUN([SSS_INTGCHECK_PYTHON_REQ], [

+     AS_IF([test x$$1 = xyes], [],

+           [sss_have_py_intg_deps=no

+            AS_IF([test -n "$3"],

+                  [AC_MSG_NOTICE([missing python dependency for integration tests: $2 not found])],

+                  [AC_MSG_ERROR([cannot enable integration tests: $2 not found])])

+           ])

+ ])

+ 

+ dnl Check for variable and fail unless value is "yes"

+ dnl The second argument will be printed in error message in case of error

+ dnl Usage:

+ dnl     SSS_CHECK_PYTHON_INTG_REQ(python_version, [non_fatal])

+ AC_DEFUN([SSS_CHECK_PYTHON_INTG_REQ], [

+     sss_have_py_intg_deps="no"

+ 

+     SSS_INTGCHECK_PYTHON_REQ([HAVE_PYTHON$1_BINDINGS],

+                              [sssd python$1 bindings], [$2])

+ 

+     AS_IF([test x$HAVE_PYTHON$1_BINDINGS = xyes],

+           [SSS_CHECK_PYTEST([$PYTHON$1], [PY$1_PYTEST])

+            []AM_PYTHON$1_MODULE([ldap])

+            []AM_PYTHON$1_MODULE([ldb])

+            []AM_PYTHON$1_MODULE([requests])

+            []AM_PYTHON$1_MODULE([dbus])

+            []AM_PYTHON$1_MODULE([psutil])

+ 

+            sss_have_py_intg_deps="yes"

+ 

+            SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1_PYTEST],

+                                     [python$1 pytest], [$2])

+            SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_LDAP],

+                                     [python$1 module ldap], [$2])

+            SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_LDB],

+                                     [python$1 module ldb], [$2])

+            SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_REQUESTS],

+                                     [python$1 module requests], [$2])

+            SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_DBUS],

+                                     [python$1 module dbus], [$2])

+            SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_PSUTIL],

+                              [python$1 module psutil], [$2])])

+ 

+     AS_IF([test "x$sss_have_py_intg_deps" = xyes],

+           [HAVE_PYTHON_INTG_DEPS=yes

+            PYTHON_EXEC_INTG=$PYTHON$1

+            AC_SUBST(PYTHON_EXEC_INTG)],

+           [HAVE_PYTHON_INTG_DEPS=no])

+     unset sss_have_py_intg_deps

+ ])

+ 

  AC_DEFUN([SSS_ENABLE_INTGCHECK_REQS], [

      AC_ARG_ENABLE(intgcheck-reqs,

          [AS_HELP_STRING([--enable-intgcheck-reqs],
@@ -29,10 +79,13 @@ 

          SSS_INTGCHECK_REQ([HAVE_SLAPD], [slapd])

          SSS_INTGCHECK_REQ([HAVE_LDAPMODIFY], [ldapmodify])

          SSS_INTGCHECK_REQ([HAVE_FAKEROOT], [fakeroot])

-         SSS_INTGCHECK_REQ([HAVE_PYTHON2], [python2])

-         SSS_INTGCHECK_REQ([HAVE_PYTEST2], [pytest2])

-         SSS_INTGCHECK_REQ([HAVE_PY2MOD_LDAP], [python-ldap])

-         SSS_INTGCHECK_REQ([HAVE_PY2MOD_LDAP], [pyldb])

+ 

+         SSS_CHECK_PYTHON_INTG_REQ([3], [just_warning])

+ 

+         AS_IF([test "x$HAVE_PYTHON_INTG_DEPS" = xyes], [],

+               dnl fallback to python2 checks due to missing

+               dnl python3 dependencies for intgcheck

+               [SSS_CHECK_PYTHON_INTG_REQ([2])])

      fi

  ])

  

file modified
+55
@@ -126,3 +126,58 @@ 

          fi

      fi

  ])

+ 

+ AC_DEFUN([AM_PYTHON3_MODULE],[

+     if test x"$PYTHON3" = x; then

+         if test -n "$2"; then

+             AC_MSG_ERROR([cannot look for $1 module: Python 3 not found])

+         else

+             AC_MSG_NOTICE([cannot look for $1 module: Python 3 not found])

+             eval AS_TR_CPP(HAVE_PY3MOD_$1)=no

+         fi

+     else

+         AC_MSG_CHECKING($(basename $PYTHON3) module: $1)

+         $PYTHON3 -c "import $1" 2>/dev/null

+         if test $? -eq 0; then

+             AC_MSG_RESULT(yes)

+             eval AS_TR_CPP(HAVE_PY3MOD_$1)=yes

+         else

+             AC_MSG_RESULT(no)

+             eval AS_TR_CPP(HAVE_PY3MOD_$1)=no

+             #

+             if test -n "$2"

+             then

+                 AC_MSG_ERROR(failed to find required module $1)

+                 exit 1

+             fi

+         fi

+     fi

+ ])

+ 

+ dnl SYNOPSIS

+ dnl

+ dnl   SSS_CHECK_PYTEST(python_interpreter, have_suffix)

+ dnl

+ dnl DESCRIPTION

+ dnl

+ dnl   Checks for pytest

+ AC_DEFUN([SSS_CHECK_PYTEST],[

+     if test x"$1" = x; then

+         if test -n "$2"; then

+             AC_MSG_ERROR([cannot look for pytest: $(basename $1) not found])

+         else

+             AC_MSG_NOTICE([cannot look for pytest module: $(basename $1) not found])

+             eval AS_TR_CPP(HAVE_$2)=no

+         fi

+     else

+         AC_MSG_CHECKING($(basename $1) pytest)

+         $1 -m pytest --version 2>/dev/null

+         if test $? -eq 0; then

+             AC_MSG_RESULT(yes)

+             eval AS_TR_CPP(HAVE_$2)=yes

+         else

+             AC_MSG_RESULT(no)

+             eval AS_TR_CPP(HAVE_$2)=no

+         fi

+     fi

+ ])

file modified
+1 -1
@@ -191,5 +191,5 @@ 

  	DBUS_SESSION_BUS_ADDRESS="unix:path=$$DBUS_SOCK_DIR/fake_socket" \

  	DBUS_SYSTEM_BUS_ADDRESS="unix:path=$$DBUS_SOCK_DIR/system_bus_socket" \

  	DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="$$DBUS_SYSTEM_BUS_ADDRESS" \

- 	    fakeroot $(PYTHON2) $(PYTEST2) -v -r a --tb=native $(INTGCHECK_PYTEST_ARGS) .

+ 	    fakeroot $(PYTHON_EXEC_INTG) -m pytest -v -r a --tb=native $(INTGCHECK_PYTEST_ARGS) .

  	rm -f $(DESTDIR)$(logpath)/*

Samba 4.11.0 dropped support for python3 and thus it was also
dropped from samba related libraries (ldb ...)
which is required by integration tests

Resolves:
https://pagure.io/SSSD/sssd/issue/4074

9 new commits added

  • intg: Install python3 dependencies for intgcheck on new distros
  • BUILD: Prefer python3 for intgcheck
  • INTG: Do hot hardcode version of python/pytest in intgcheck
  • BUILD: Move python checks for intgcheck to macro
  • BUILD: Change value of variable HAVE_PYTHON2/3_BINDINGS
  • BUILD: Add macro for checking pytest for intgcheck
  • BUILD: Move checking of python2 modules for intgcheck
  • BUILD: Fix typo of detecting python module for intgcheck
  • BUILD: Add macro for checking python3 modules
4 years ago

Thank you.

Samba 4.11.0 dropped support for python3 and thus it was also
dropped from samba related libraries (ldb ...)
which is required by integration tests

I guess it should say python2. Otherwise it looks good to me. I will run some test before acking.

I change the commit message so it says that python2 was dropped instead of python3 and I'm going to push the patches. CI passed on all systems.

Commit 5dc86be fixes this pull-request

Pull-Request has been merged by pbrezina

4 years ago

Commit 0e1346b fixes this pull-request

Pull-Request has been merged by pbrezina

4 years ago
  • master
    • e613dd34bd26c6ab32186c7393177de41c5ef628 - intg: Install python3 dependencies for intgcheck on new distros
    • d30904d898c46613aac97eecf43c84bdea3cd278 - BUILD: Prefer python3 for intgcheck
    • 5be4ebf9c92bb5e305c52bc89c6c7f62bfe8d81d - INTG: Do hot hardcode version of python/pytest in intgcheck
    • a34ea677d9eb5e829d207bb9aae7520f7a3533ac - BUILD: Move python checks for intgcheck to macro
    • 69832d49b627d7237bc3ce449e0930c25fa17eef - BUILD: Change value of variable HAVE_PYTHON2/3_BINDINGS
    • 784b17bef1d68f7bcc51ae80bcd31edfb4ed384f - BUILD: Add macro for checking pytest for intgcheck
    • fd0e08fce33b5119c400f322c6227c527093d4ce - BUILD: Move checking of python2 modules for intgcheck
    • fbd9c987699349c951c380a88381dce4962856ed - BUILD: Fix typo of detecting python module for intgcheck
    • 768c295b5c35fca5964ea17e030c2a2fbce2b816 - BUILD: Add macro for checking python3 modules

Pull-Request has been closed by pbrezina

4 years ago

I change the commit message so it says that python2 was dropped instead of python3 and I'm going to push the patches. CI passed on all systems.

Thank you very much for fixing typo. (sorry, I was busy with other tasks yesterday).
BTW it should have not been necessary to close PR.
I added comment to few commit

 Merges: https://pagure.io/SSSD/sssd/pull-request/4075

And you can see even messages in this PR that it was merged.
If PR was not automatically marked as merged than there is a bug in pagure :-)