Changeset 1ca493a


Ignore:
Timestamp:
Jun 25, 2020, 8:26:37 PM (5 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
b56827
Parents:
912a6f
git-author:
Frederik Heber <frederik.heber@…> (04/16/19 23:09:54)
git-committer:
Frederik Heber <frederik.heber@…> (06/25/20 20:26:37)
Message:

Allowing python3 usage.

  • Init function name changes on python2/3.
  • added test and AC_DEFINEs to configure.ac.
  • PythonScripting branches on these preprocessor defines.
  • removed ax_python.m4.
  • FIX: boost.m4 overwrites BOOST_PYTHON_LIBS pulled from python-config which caused the issues with ax_python.m4 and boost.m4 checking for different python versions. Added BOOST_PYTHON_LIB which contains the python libs needed.
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r912a6f r1ca493a  
    3636  # Python (for boost::python)
    3737  AM_PATH_PYTHON([2.2])
    38   AX_PYTHON
    3938  AC_DEFINE(HAVE_PYTHON,1, ["Build python module and scripts."])
    4039])
     40python_version_major=`echo $PYTHON_VERSION | sed -e "s#\([0-9]\)\..*#\1#"`
    4141AM_CONDITIONAL([CONDPYTHON], [test x"$enable_python" != x"no"])
     42AS_IF([test x"$python_version_major" = x"2"],[
     43        AC_DEFINE(HAVE_PYTHON2, 1, ["using python version 2"])
     44],[test x"$python_version_major" = x"3"],[
     45        AC_DEFINE(HAVE_PYTHON3, 1, ["using python version 3"])
     46])
    4247AC_SUBST(HAVE_PYTHON)
    4348
  • m4/boost.m4

    r912a6f r1ca493a  
    11221122_BOOST_PYTHON_CONFIG([LDFLAGS],   [ldflags])
    11231123_BOOST_PYTHON_CONFIG([LIBS],      [libs])
     1124AC_SUBST([BOOST_PYTHON_LIB], [$BOOST_PYTHON_LIBS])
    11241125m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl
    11251126BOOST_FIND_LIBS([python], [python python3], [$1],
  • python/Makefile.am

    r912a6f r1ca493a  
    1818        ../src/Actions/GlobalListOfActions.hpp \
    1919        ../src/Actions/ActionHistory.hpp
    20 pyMoleCuilder_la_CPPFLAGS = $(AM_CPPFLAGS) ${BOOST_CPPFLAGS} ${CodePatterns_CFLAGS} $(JobMarket_CFLAGS) -I$(PYTHON_INCLUDE_DIR)
    21 pyMoleCuilder_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info $(MOLECUILDER_SO_VERSION) -shared $(BOOST_PYTHON_LDFLAGS)
     20pyMoleCuilder_la_CPPFLAGS = \
     21        $(AM_CPPFLAGS) \
     22        ${BOOST_CPPFLAGS} \
     23        ${CodePatterns_CFLAGS} \
     24        $(JobMarket_CFLAGS) \
     25        $(BOOST_PYTHON_CPPFLAGS)
     26pyMoleCuilder_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info $(MOLECUILDER_SO_VERSION) -shared $(BOOST_PYTHON_LDFLAGS) $(BOOST_PYTHON_LDFLAGS)
    2227pyMoleCuilder_la_LIBADD = \
    2328        $(top_builddir)/src/libMolecuilderUI.la
    2429pyMoleCuilder_la_LIBADD += \
    2530        $(BOOST_PYTHON_LIBS) \
    26         ${CodePatterns_LIBS} \
    27         -l$(PYTHON_LIB)
     31        $(BOOST_PYTHON_LIB) \
     32        ${CodePatterns_LIBS}
    2833endif
    2934
  • src/Makefile.am

    r912a6f r1ca493a  
    323323        Actions/Action_impl_python.hpp \
    324324        Actions/GlobalListOfActions.hpp
    325 molecuilder_CPPFLAGS += -I$(PYTHON_INCLUDE_DIR)
     325molecuilder_CPPFLAGS += $(BOOST_PYTHON_CPPFLAGS)
    326326molecuilder_LDFLAGS += $(BOOST_PYTHON_LDFLAGS)
    327327molecuilder_LDADD += \
    328328        $(BOOST_PYTHON_LIBS) \
    329         ${CodePatterns_LIBS} \
    330         -l$(PYTHON_LIB)
     329        $(BOOST_PYTHON_LIB) \
     330        ${CodePatterns_LIBS}
    331331endif
    332332
     
    363363        Actions/Action_impl_python.hpp \
    364364        Actions/GlobalListOfActions.hpp
    365 molecuildergui_CPPFLAGS += -I$(PYTHON_INCLUDE_DIR)
     365molecuildergui_CPPFLAGS += $(BOOST_PYTHON_CPPFLAGS)
    366366molecuildergui_LDFLAGS += $(BOOST_PYTHON_LDFLAGS)
    367367molecuildergui_LDADD += \
    368368        $(BOOST_PYTHON_LIBS) \
    369         ${CodePatterns_LIBS} \
    370         -l$(PYTHON_LIB)
     369        $(BOOST_PYTHON_LIB) \
     370        ${CodePatterns_LIBS}
    371371endif
    372372
  • src/Python/Makefile.am

    r912a6f r1ca493a  
    1919noinst_LTLIBRARIES += libMolecuilderPython.la
    2020libMolecuilderPython_la_includedir = $(includedir)/MoleCuilder/
    21 libMolecuilderPython_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(PYTHON_INCLUDE_DIR)
     21libMolecuilderPython_la_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_PYTHON_CPPFLAGS)
    2222libMolecuilderPython_la_LDFLAGS = $(AM_LDFLAGS) $(BOOST_PYTHON_LDFLAGS)
    2323libMolecuilderPython_la_LIBADD = \
    2424        $(BOOST_PYTHON_LIBS) \
    25         ${CodePatterns_LIBS} \
    26         -l$(PYTHON_LIB)
     25        $(BOOST_PYTHON_LIB) \
     26        ${CodePatterns_LIBS}
    2727
    2828nobase_libMolecuilderPython_la_include_HEADERS = ${PYTHONHEADER}
  • src/Python/PythonScripting.cpp

    r912a6f r1ca493a  
    5454{
    5555  try {
     56#ifdef HAVE_PYTHON2
    5657    PyImport_AppendInittab( "pyMoleCuilder", &initpyMoleCuilder );
     58#else
     59    PyImport_AppendInittab( "pyMoleCuilder", &PyInit_pyMoleCuilder );
     60#endif
    5761
    5862    Py_Initialize();
     
    6670    main_namespace["pyMoleCuilder"] = molecuilder_module;
    6771
    68     std::string enveloped_script("print \"BEGIN of "+python_scripttitle+":\"\n");
     72    std::string enveloped_script("print(\"BEGIN of "+python_scripttitle+":\")\n");
    6973    enveloped_script += python_string+std::string("\n");
    70     enveloped_script += std::string("print \"END of "+python_scripttitle+":\"\n");
     74    enveloped_script += std::string("print(\"END of "+python_scripttitle+":\")\n");
    7175
    7276    boost::python::handle<> ignored(( PyRun_String( enveloped_script.c_str(),
Note: See TracChangeset for help on using the changeset viewer.