[geos-devel] [GEOS] #774: GEOS and Python3

GEOS geos-trac at osgeo.org
Thu Jan 5 10:22:37 PST 2017


#774: GEOS and Python3
------------------------+---------------------------
 Reporter:  citibeth    |       Owner:  geos-devel@…
     Type:  defect      |      Status:  new
 Priority:  major       |   Milestone:  3.5.2
Component:  Default     |     Version:  3.5.0
 Severity:  Unassigned  |  Resolution:
 Keywords:              |
------------------------+---------------------------

Comment (by andreash):

 From what I can see, this is only caused by the `print` statements in the
 `configure` script.

 This patch fixes these issues for me (GEOS-3.5.0):

 {{{
 --- configure.orig      2016-12-29 17:33:15.229294313 +0100
 +++ configure   2016-12-29 18:33:27.822625611 +0100
 @@ -18329,7 +18329,7 @@
  if ${am_cv_python_version+:} false; then :
    $as_echo_n "(cached) " >&6
  else
 -  am_cv_python_version=`$PYTHON -c "import sys; print sys.version[:3]"`
 +  am_cv_python_version=`$PYTHON -c "import sys; print(sys.version[:3])"`
  fi
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version"
 >&5
  $as_echo "$am_cv_python_version" >&6; }
 @@ -18348,7 +18348,7 @@
  if ${am_cv_python_platform+:} false; then :
    $as_echo_n "(cached) " >&6
  else
 -  am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`
 +  am_cv_python_platform=`$PYTHON -c "import sys; print(sys.platform)"`
  fi
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_platform"
 >&5
  $as_echo "$am_cv_python_platform" >&6; }
 @@ -18362,7 +18362,7 @@
  if ${am_cv_python_pythondir+:} false; then :
    $as_echo_n "(cached) " >&6
  else
 -  am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig;
 print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null
 ||
 +  am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig;
 print(sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX'))" 2>/dev/null
 ||
       echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`
  fi
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pythondir"
 >&5
 @@ -18379,7 +18379,7 @@
  if ${am_cv_python_pyexecdir+:} false; then :
    $as_echo_n "(cached) " >&6
  else
 -  am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig;
 print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')"
 2>/dev/null ||
 +  am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig;
 print(sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX'))"
 2>/dev/null ||
       echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-
 packages"`
  fi
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_pyexecdir"
 >&5
 @@ -18448,19 +18448,21 @@
          # Check for Python library path
          { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python
 library path" >&5
  $as_echo_n "checking for Python library path... " >&6; }
 -        for i in "$base_python_path/lib/python$PYTHON_VERSION/config/"
 "$base_python_path/lib/python$PYTHON_VERSION/"
 "$base_python_path/lib/python/config/" "$base_python_path/lib/python/"
 "$base_python_path/" "$base_python_path/libs/" ; do
 -                python_path=`find $i -name libpython$PYTHON_VERSION.*
 -print 2> /dev/null | sed "1q"`
 +        for i in "$base_python_path/lib/python$PYTHON_VERSION/config/"
 "$base_python_path/lib/python$PYTHON_VERSION/"
 "$base_python_path/lib/python/config/" "$base_python_path/lib/python/"
 "$base_python_path/" "$base_python_path/libs/" "$base_python_path/lib/" ;
 do
 +                python_path=`find $i -name libpython$PYTHON_VERSION*.so*
 -print 2> /dev/null | sed "1q"`
                  if test -n "$python_path" ; then
                          break
                  fi
          done
 +
 +        lpython_name=`python -c "import os;
 print(os.path.split(\"$python_path\")[1].split(\".so\")[0].split(\"lib\")[1])"`
          python_path=`echo $python_path | sed "s,/libpython.*$,,"`
          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $python_path"
 >&5
  $as_echo "$python_path" >&6; }
          if test -z "$python_path" ; then
                  as_fn_error $? "cannot find Python library path"
 "$LINENO" 5
          fi
 -        PYTHON_LDFLAGS="-L$python_path -lpython$PYTHON_VERSION"
 +        PYTHON_LDFLAGS="-L$python_path -l$lpython_name"

          #
          python_site=`echo $base_python_path | sed "s/config/site-
 packages/"`
 }}}

 Feel free to include it.

--
Ticket URL: <https://trac.osgeo.org/geos/ticket/774#comment:3>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).


More information about the geos-devel mailing list