Changeset: e77155d228ae for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e77155d228ae
Modified Files:
        MonetDB.spec
        NT/monetdb_config.h.in
        NT/rules.msc
        clients/Tests/All
        configure.ag
        debian/control
        debian/fix-deb.sh
        debian/monetdb-testing-python.install
        sql/backends/monet5/Tests/All
        sql/backends/monet5/UDF/Makefile.ag
        sql/backends/monet5/UDF/pyapi/Makefile.ag
        sql/backends/monet5/UDF/pyapi/Tests/All
        sql/backends/monet5/UDF/pyapi3/Tests/All
        sql/test/BugTracker-2017/Tests/All
        sql/test/BugTracker-2018/Tests/All
        
sql/test/BugTracker-2018/Tests/remote-table-where-is-null.Bug-6601.stable.out
        
sql/test/BugTracker-2018/Tests/remote-table-where-not-equal.Bug-6621.stable.out
        sql/test/mapi/Tests/All
        sql/test/merge-partitions/Tests/All
        testing/Mtest.py.in
Branch: default
Log Message:

Clean up configure checks for Python; use Python 3 for testing if available.


diffs (truncated from 1208 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -100,8 +100,8 @@
 %bcond_without fits
 %endif
 
-%{!?__python2: %global __python2 %__python}
-%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from 
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%{!?__python3: %global __python3 /usr/bin/python3}
+%{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from 
distutils.sysconfig import get_python_lib; print(get_python_lib())")}
 
 Name: %{name}
 Version: %{version}
@@ -126,6 +126,7 @@ BuildRequires: hardlink
 %endif
 BuildRequires: gcc
 BuildRequires: bison
+BuildRequires: /usr/bin/python3
 %if %{?rhel:1}%{!?rhel:0}
 BuildRequires: bzip2-devel
 %else
@@ -397,7 +398,7 @@ Recommends: perl-DBD-monetdb >= 1.0
 Recommends: php-monetdb >= 1.0
 %endif
 Requires: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
-Requires: python-pymonetdb >= 1.0.6
+Requires: python3-pymonetdb >= 1.0.6
 
 %description client-tests
 MonetDB is a database management system that is developed from a
@@ -846,7 +847,7 @@ Summary: MonetDB - Monet Database Manage
 Group: Applications/Databases
 Requires: %{name}-testing = %{version}-%{release}
 Requires: %{name}-client-tests = %{version}-%{release}
-Requires: python
+Requires: /usr/bin/python3
 BuildArch: noarch
 
 %description testing-python
@@ -863,8 +864,8 @@ developer, but if you do want to test, t
 %defattr(-,root,root)
 %{_bindir}/Mapprove.py
 %{_bindir}/Mtest.py
-%dir %{python2_sitelib}/MonetDBtesting
-%{python2_sitelib}/MonetDBtesting/*
+%dir %{python3_sitelib}/MonetDBtesting
+%{python3_sitelib}/MonetDBtesting/*
 
 %if %{?rhel:0}%{!?rhel:1} || 0%{?rhel} >= 7
 %package selinux
@@ -990,8 +991,8 @@ export CFLAGS
        --with-openssl=yes \
        --with-proj=no \
        --with-pthread=yes \
-       --with-python2=yes \
-       --with-python3=%{?with_py3integration:yes}%{!?with_py3integration:no} \
+       --with-python2=%{?with_py2integration:yes}%{!?with_py2integration:no} \
+       --with-python3=yes \
        --with-readline=yes \
        --with-regex=%{?with_pcre:PCRE}%{!?with_pcre:POSIX} \
        --with-samtools=%{?with_samtools:yes}%{!?with_samtools:no} \
diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -264,7 +264,7 @@
 /* #undef HAVE_LIBPTHREAD */
 
 /* Define if we can link to python */
-/* #undef HAVE_LIBPY */
+/* #undef HAVE_LIBPY2 */
 
 /* Define if we can link to python */
 /* #undef HAVE_LIBPY3 */
diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -69,7 +69,6 @@ PYTHON2BASE=C:\Python27
 !IFNDEF PYTHON2LIB
 PYTHON2LIB=python27.lib
 !ENDIF
-PYTHON2_LIBDIR=share\MonetDB\python
 
 !IFNDEF PYTHON3BASE
 PYTHON3BASE=C:\Python32
@@ -77,15 +76,8 @@ PYTHON3BASE=C:\Python32
 !IFNDEF PYTHON3LIB
 PYTHON3LIB=python32.lib
 !ENDIF
-PYTHON3_LIBDIR=share\MonetDB\python3
 
-!IFDEF PYTHON2BASE
-PYTHON_LIBDIR=$(PYTHON2_LIBDIR)
-!ELSE
-!IFDEF PYTHON3BASE
-PYTHON_LIBDIR=$(PYTHON3_LIBDIR)
-!ENDIF
-!ENDIF
+PYTHON_LIBDIR=share\MonetDB\python
 
 !IFDEF HAVE_PCRE
 # This is the location of the PCRE library
@@ -173,13 +165,13 @@ libr_CFLAGS = -DHAVE_LIBR "-I$(LIBR)\inc
 
 # generate R.lib from R.dll, needed for linking
 R.lib: "$(libr_DLL)"
-       dumpbin /exports "$(libr_DLL)" | python "$(TOPDIR)\..\NT\makelibdef.py" 
> R.def
+       dumpbin /exports "$(libr_DLL)" | "$(PYTHON)" 
"$(TOPDIR)\..\NT\makelibdef.py" > R.def
        lib /machine:$(BITSMCHN) /def:R.def /out:R.lib
 !ENDIF
 
-!IFDEF HAVE_LIBPY
-libpy_LIBS = "$(PYTHON2DIR)\libs\python27.lib"
-libpy_CFLAGS = -DHAVE_LIBPY "-I$(PYTHON2DIR)\include" 
"-I$(PYTHON2DIR)\Lib\site-packages\numpy\core\include"
+!IFDEF HAVE_LIBPY2
+libpy2_LIBS = "$(PYTHON2DIR)\libs\python27.lib"
+libpy2_CFLAGS = -DHAVE_LIBPY2 "-I$(PYTHON2DIR)\include" 
"-I$(PYTHON2DIR)\Lib\site-packages\numpy\core\include"
 !ENDIF
 
 !IFDEF HAVE_LIBPY3
@@ -191,6 +183,7 @@ libpy3_CFLAGS = -DHAVE_LIBPY3 "-I$(PYTHO
 
 # install python, flex and bison on your systems
 # PYTHON may be either a version 2 or a version 3
+# here we let %Path% determine which version we get
 PYTHON = python
 YACC = bison
 LEX = flex
@@ -328,10 +321,10 @@ create_winconfig_conds_new_py:
 !ELSE
        $(ECHO) HAVE_LIBLZMA_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ENDIF
-!IFDEF HAVE_LIBPY
-       $(ECHO) HAVE_LIBPY_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
+!IFDEF HAVE_LIBPY2
+       $(ECHO) HAVE_LIBPY2_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ELSE
-       $(ECHO) HAVE_LIBPY_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
+       $(ECHO) HAVE_LIBPY2_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ENDIF
 !IFDEF HAVE_LIBPY3
        $(ECHO) HAVE_LIBPY3_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
@@ -383,21 +376,6 @@ create_winconfig_conds_new_py:
 !ELSE
        $(ECHO) HAVE_PROJ_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ENDIF
-!IFDEF HAVE_PYTHON
-       $(ECHO) HAVE_PYTHON_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ELSE
-       $(ECHO) HAVE_PYTHON_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ENDIF
-!IFDEF HAVE_PYTHON2
-       $(ECHO) HAVE_PYTHON2_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ELSE
-       $(ECHO) HAVE_PYTHON2_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ENDIF
-!IFDEF HAVE_PYTHON3
-       $(ECHO) HAVE_PYTHON3_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ELSE
-       $(ECHO) HAVE_PYTHON3_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py"
-!ENDIF
 !IFDEF HAVE_SAMTOOLS
        $(ECHO) HAVE_SAMTOOLS_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py"
 !ELSE
@@ -439,7 +417,7 @@ update_winconfig_conds_py: create_wincon
        cmp -s "$(TOPDIR)\winconfig_conds_new.py" 
"$(TOPDIR)\winconfig_conds.py" || \
        $(CP) "$(TOPDIR)\winconfig_conds_new.py" "$(TOPDIR)\winconfig_conds.py"
 
-CONFIGURE=$(PYTHON) $(CONFIGURE_PY) \
+CONFIGURE="$(PYTHON)" $(CONFIGURE_PY) \
        "$(TOPDIR)\winconfig_conds.py" \
        "prefix=$(prefix)" \
        "LIBICONV=$(LIBICONV)" \
@@ -449,9 +427,7 @@ CONFIGURE=$(PYTHON) $(CONFIGURE_PY) \
        "PYTHON=$(PYTHON)" \
        "PYTHON_LIBDIR=$(PYTHON_LIBDIR)" \
        "PYTHON2=$(PYTHON2)" \
-       "PYTHON2_LIBDIR=$(PYTHON2_LIBDIR)" \
        "PYTHON3=$(PYTHON3)" \
-       "PYTHON3_LIBDIR=$(PYTHON3_LIBDIR)" \
        "TOPDIR=$(TOPDIR)" \
        "VERSION=$(VERSION)" \
        "builtby=%USER%@%COMPUTERNAME%" \
diff --git a/clients/Tests/All b/clients/Tests/All
--- a/clients/Tests/All
+++ b/clients/Tests/All
@@ -1,4 +1,4 @@
 exports
-HAVE_FITS&HAVE_GEOM&HAVE_LIBPY&HAVE_LIBR&HAVE_LIDAR&HAVE_NETCDF&HAVE_SAMTOOLS&HAVE_SHP?MAL-signatures
+HAVE_FITS&HAVE_GEOM&HAVE_LIBPY2&HAVE_LIBR&HAVE_LIDAR&HAVE_NETCDF&HAVE_SAMTOOLS&HAVE_SHP?MAL-signatures
 MERCURIAL?malcheck
 mclient-uri
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -29,7 +29,7 @@ dnl     The two versions are compared, t
 dnl     whether the first version is less than, equal to, or greater
 dnl     than the second version is executed.
 
-dnl  AS_VAR_IF(var, word, eq-body, ne-body)
+dnl  AS_VAR_IF(var, word, eq-body [, ne-body])
 dnl     If $var is equal to word, execute eq-body, else execute ne-body.
 
 dnl  AS_VAR_COPY(dest, src)
@@ -365,7 +365,6 @@ AC_SUBST([MONETDB5_PASSWDHASH])
 
 AC_DISABLE_STATIC
 AC_ENABLE_SHARED
-AM_CONDITIONAL([CROSS_COMPILING], [test x$cross_compiling = xyes])
 
 # logs usually end up in /var/log
 logdir='${localstatedir}/log/monetdb'
@@ -801,9 +800,7 @@ translatepath=echo
 AC_ARG_WITH([translatepath],
        [AS_HELP_STRING([--with-translatepath=PROG],
                [program to translate paths from configure-time format to 
execute-time format.  Take care that this program can be given paths like 
${prefix}/etc which should be translated carefully.])],
-       [translatepath="$withval"],
-       [AS_VAR_IF([cross_compiling], [yes],
-               [AC_MSG_WARN([Cross compiling, but no --with-translatepath 
option given])])])
+       [translatepath="$withval"])
 
 AC_MSG_CHECKING([for --enable-debug])
 AS_CASE([$enable_debug],
@@ -1017,6 +1014,20 @@ AC_DEFINE_UNQUOTED([DIFF], ["$DIFF"], [P
 
 AC_CHECK_PROGS([RPMBUILD], [rpmbuild])
 
+# This is how we use the various Python-related configuration variables.
+# PYTHON - the Python interpreter we use for testing.  This can either
+#    be Python 3 (preferred) or Python 2.  Set automatically.
+# PYTHON_LIBDIR - the location where the MonetDBtesting module, used
+#    during testing, is installed.  Based on PYTHON.
+# PYTHON2 - the Python version 2 interpreter
+# PYTHON3 - the Python version 3 interpreter
+# HAVE_LIBPY2 - Python 2 libraries available for linking to
+# libpy2_CFLAGS - compiler flags to compile with Python 2
+# libpy2_LIBS - Python 2 libraries to be linked
+# HAVE_LIBPY3 - Python 3 libraries available for linking to
+# libpy3_CFLAGS - compiler flags to compile with Python 3
+# libpy3_LIBS - Python 3 libraries to be linked
+
 # check major version of python
 # check if python2 and python3 exist
 # if python2 or python3 doesn't exist, use python if major matches
@@ -1057,147 +1068,81 @@ AC_PATH_PROG([PYTHON], [python], [no], [
 PYTHON_MAJ=unknown
 AS_VAR_IF([PYTHON], [no], [], [
        AC_MSG_CHECKING([major version of $PYTHON])
-       AS_CASE([`"$PYTHON" -V 2>&1`],
-               ["Python 2."[[67]]*], [
-                       PYTHON_MAJ=2],
-               ["Python 3."*], [
-                       PYTHON_MAJ=3])
+       PYTHON_MAJ=`"$PYTHON" -c 'import sys; print(sys.version[[:1]])'`
        AC_MSG_RESULT([$PYTHON_MAJ])])
 
 AS_VAR_IF([have_python2], [no],
-       [],
-       [AS_VAR_IF([cross_compiling], [yes],
-               [],
-               [AC_PATH_PROG([PYTHON2], [$PYTHON2], [no], [$PATH])
-                AS_VAR_IF([PYTHON2], [no],
-                       [AS_IF([test '(' "x$have_python2" = xyes -o 
"x$have_python2" = xauto ')' -a "x$PYTHON_MAJ" = x2],
-                               [PYTHON2="$PYTHON"
-                                have_python2=yes],
-                               [AS_VAR_IF([have_python2], [auto],
-                                       [have_python2=no
-                                        why_not_python2="(Python 2 executable 
not found)"],
-                                       [AC_MSG_ERROR([Python 2 executable not 
found])])])],
-                       [AS_CASE([`"$PYTHON2" -V 2>&1`],
-                               ["Python 2."[[67]]*], [],
-                               [AS_VAR_IF([have_python2], [auto], [
-                                       have_python2=no
-                                       why_not_python2="(Python 2 executable 
too old)"], [
-                                       AC_MSG_ERROR([Python 2 executable too 
old])])])])])])
-
-AS_VAR_IF([have_python2], [no],
-       [# no Python 2 implies no Python 2 libraries
-        have_python2_libdir=no
-        PYTHON2_LIBDIR=""
-        # and no interpreter
-        PYTHON2=false],
-       [have_python2_libdir=auto
-        AC_ARG_WITH([python2-libdir],
-               [AS_HELP_STRING([--with-python2-libdir=DIR],
-                       [relative path for Python 2 library directory (where 
Python 2 modules should be installed)])],
-               [have_python2_libdir="$withval"])
-        AS_CASE([$have_python2_libdir],
-               [yes|auto], [
-                       AS_VAR_IF([cross_compiling], [yes],
-                               [AC_MSG_ERROR([Must specify 
--with-python2-libdir when cross compiling])])
-                       AS_CASE([$host_os-`"$PYTHON2" -V 2>&1`],
-                               [darwin9*-*2.5.1], [
-                                       # This is the Python installed on OSX 
Leopard, in
-                                       # later versions of OSX, Python is 
fixed to return
-                                       # standard output
-                                       PYTHON2_LIBDIR=`"$PYTHON2" -c 'import 
distutils.sysconfig; print 
distutils.sysconfig.get_python_lib(0,1,"'"$Qprefix"'")' 
2>/dev/null`/site-packages],
-                               [
-                                       # Use prefix field for Ubuntu Python, 
bug #3207
-                                       PYTHON2_LIBDIR=`"$PYTHON2" -c 'import 
distutils.sysconfig; print 
distutils.sysconfig.get_python_lib(0,0,"'"$Qprefix"'")' 2>/dev/null`])
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to