Commit e7fc59a82555830ae7f5e86ce0bbf0f85718c322

Authored by Jürgen Knödlseder
1 parent 5c264dcb

Add "PYTHON_RELATIVE_IMPORT" to deal with Python 2 and 3 differences in import.

configure.ac
... ... @@ -624,14 +624,11 @@ else
624 624  
625 625 # Set opening and closing symbols to make setup.py compatible for versions 2 and 3
626 626 if test ${PYTHON_VERSION} '<' 3; then
627   - PYTHON_OPEN=" "
628   - PYTHON_CLOSE=""
  627 + PYTHON_RELATIVE_IMPORT=" "
629 628 else
630   - PYTHON_OPEN="("
631   - PYTHON_CLOSE=")"
  629 + PYTHON_RELATIVE_IMPORT="."
632 630 fi
633   - AC_SUBST(PYTHON_OPEN)
634   - AC_SUBST(PYTHON_CLOSE)
  631 + AC_SUBST(PYTHON_RELATIVE_IMPORT)
635 632  
636 633 # Do we have distutils?
637 634 AC_MSG_CHECKING([for the distutils Python package])
... ...
pyext/ctools/__init__.py.in
... ... @@ -21,12 +21,7 @@
21 21 import gammalib
22 22  
23 23 # Import sub modules
24   -#from .tools import *
25   -import sys
26   -if sys.version_info[0] < 3:
27   - from tools import *
28   -else:
29   - from .tools import *
  24 +from @PYTHON_RELATIVE_IMPORT@tools import *
30 25  
31 26 # Remove swig register stuff
32 27 bad_entries = [entry for entry in list(locals())
... ...