From e7fc59a82555830ae7f5e86ce0bbf0f85718c322 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 26 Feb 2016 00:56:10 +0100 Subject: [PATCH] Add "PYTHON_RELATIVE_IMPORT" to deal with Python 2 and 3 differences in import. --- configure.ac | 9 +++------ pyext/ctools/__init__.py.in | 7 +------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 66fb43f..59ba4ab 100644 --- a/configure.ac +++ b/configure.ac @@ -624,14 +624,11 @@ else # Set opening and closing symbols to make setup.py compatible for versions 2 and 3 if test ${PYTHON_VERSION} '<' 3; then - PYTHON_OPEN=" " - PYTHON_CLOSE="" + PYTHON_RELATIVE_IMPORT=" " else - PYTHON_OPEN="(" - PYTHON_CLOSE=")" + PYTHON_RELATIVE_IMPORT="." fi - AC_SUBST(PYTHON_OPEN) - AC_SUBST(PYTHON_CLOSE) + AC_SUBST(PYTHON_RELATIVE_IMPORT) # Do we have distutils? AC_MSG_CHECKING([for the distutils Python package]) diff --git a/pyext/ctools/__init__.py.in b/pyext/ctools/__init__.py.in index 57a41a0..9ca877e 100644 --- a/pyext/ctools/__init__.py.in +++ b/pyext/ctools/__init__.py.in @@ -21,12 +21,7 @@ import gammalib # Import sub modules -#from .tools import * -import sys -if sys.version_info[0] < 3: - from tools import * -else: - from .tools import * +from @PYTHON_RELATIVE_IMPORT@tools import * # Remove swig register stuff bad_entries = [entry for entry in list(locals()) -- libgit2 0.21.4