Commit 7b570a15ae0dc8abb6149112e878021f7fbe299f

Authored by Jürgen Knödlseder
1 parent 30daf3a5

Handle relative imports for Python 2.

configure.ac
@@ -624,11 +624,14 @@ else @@ -624,11 +624,14 @@ else
624 624
625 # Set opening and closing symbols to make setup.py compatible for versions 2 and 3 625 # Set opening and closing symbols to make setup.py compatible for versions 2 and 3
626 if test ${PYTHON_VERSION} '<' 3; then 626 if test ${PYTHON_VERSION} '<' 3; then
627 - PYTHON_RELATIVE_IMPORT=" " 627 + PYTHON_RELATIVE_IMPORT=""
  628 + PYTHON_FROM_DOT_=""
628 else 629 else
629 PYTHON_RELATIVE_IMPORT="." 630 PYTHON_RELATIVE_IMPORT="."
  631 + PYTHON_FROM_DOT_="from . "
630 fi 632 fi
631 AC_SUBST(PYTHON_RELATIVE_IMPORT) 633 AC_SUBST(PYTHON_RELATIVE_IMPORT)
  634 + AC_SUBST(PYTHON_FROM_DOT_)
632 635
633 # Do we have distutils? 636 # Do we have distutils?
634 AC_MSG_CHECKING([for the distutils Python package]) 637 AC_MSG_CHECKING([for the distutils Python package])
cscripts/__init__.py.in
@@ -63,7 +63,7 @@ from @PYTHON_RELATIVE_IMPORT@cssens import cssens @@ -63,7 +63,7 @@ from @PYTHON_RELATIVE_IMPORT@cssens import cssens
63 from @PYTHON_RELATIVE_IMPORT@csspec import csspec 63 from @PYTHON_RELATIVE_IMPORT@csspec import csspec
64 from @PYTHON_RELATIVE_IMPORT@cstsdist import cstsdist 64 from @PYTHON_RELATIVE_IMPORT@cstsdist import cstsdist
65 from @PYTHON_RELATIVE_IMPORT@cstsmapmerge import cstsmapmerge 65 from @PYTHON_RELATIVE_IMPORT@cstsmapmerge import cstsmapmerge
66 -from . import obsutils 66 +@PYTHON_FROM_DOT_@import obsutils
67 if cur_version > req_version: 67 if cur_version > req_version:
68 from @PYTHON_RELATIVE_IMPORT@csfindobs import csfindobs 68 from @PYTHON_RELATIVE_IMPORT@csfindobs import csfindobs
69 from @PYTHON_RELATIVE_IMPORT@csiactcopy import csiactcopy 69 from @PYTHON_RELATIVE_IMPORT@csiactcopy import csiactcopy