From 72691e5a4992f923aa97a027d464a496344106cb Mon Sep 17 00:00:00 2001
From: Olly Betts
-$ swig -python example.i +$ swig -python -lembed.i example.i $ gcc example.c example_wrap.c \ -Xlinker -export-dynamic \ - -DHAVE_CONFIG_H -I/usr/local/include/python2.1 \ - -I/usr/local/lib/python2.1/config \ - -L/usr/local/lib/python2.1/config -lpython2.1 -lm -ldl \ + -DHAVE_CONFIG_H -I/usr/include/python2.7 \ + -I/usr/lib/python2.7/config-x86_64-linux-gnu \ + -I/usr/lib/python2.7/config \ + -L/usr/lib/python2.7/config -lpython2.7 -lm -ldl \ -o mypython -
You will need to supply the same libraries that were used to build Python the first @@ -490,8 +490,8 @@ hassle in the opinion of this author).
Compatibility note: The embed.i library file is -deprecated and has not been maintained for several years. Even though it -appears to "work" with Python 2.1, no future support is guaranteed. +deprecated and has not been actively maintained for many years. Even though it +appears to "work" with Python 2.7, no future support is guaranteed. If using static linking, you might want to rely on a different approach (perhaps using distutils).
diff --git a/Lib/python/README b/Lib/python/README index 98ec5605d..fa8ef61e7 100644 --- a/Lib/python/README +++ b/Lib/python/README @@ -15,7 +15,6 @@ complex.i C99 or C++ complex type cstring.i Various forms of C character string handling cwstring.i Various forms of C wchar_t string handling embed.i embedding the Python interpreter in something else -embed15.i embedding the Python interpreter in something else file.i FILE C type implicit.i Allow the use of implicit C++ constructors wchar.i wchar_t C type diff --git a/Lib/python/embed.i b/Lib/python/embed.i index c29e8fd9f..5b259ade4 100644 --- a/Lib/python/embed.i +++ b/Lib/python/embed.i @@ -1,8 +1,8 @@ // // embed.i // SWIG file embedding the Python interpreter in something else. -// This file is based on Python-1.5. It will not work with -// earlier versions. +// This file is deprecated and no longer actively maintained, but it still +// seems to work with Python 2.7. Status with Python 3 is unknown. // // This file makes it possible to extend Python and all of its // built-in functions without having to hack its setup script. @@ -24,13 +24,8 @@ present in your current Python executable (including any special purpose modules you have enabled such as Tkinter). Thus, you may need to provide additional link libraries when compiling. -This library file only works with Python 1.5. A version -compatible with Python 1.4 is available as embed14.i and -a Python1.3 version is available as embed13.i. As far as -I know, this module is C++ safe. +As far as I know, this module is C++ safe. %} -#else -%echo "embed.i : Using Python 1.5" #endif %wrapper %{ diff --git a/Lib/python/embed15.i b/Lib/python/embed15.i deleted file mode 100644 index 3c419b9a3..000000000 --- a/Lib/python/embed15.i +++ /dev/null @@ -1,115 +0,0 @@ -/* ----------------------------------------------------------------------------- - * embed15.i - * - * SWIG file embedding the Python interpreter in something else. - * This file is based on Python-1.5. It will not work with - * earlier versions. - * - * This file makes it possible to extend Python and all of its - * built-in functions without having to hack its setup script. - * ----------------------------------------------------------------------------- */ - -#ifdef AUTODOC -%subsection "embed.i" -%text %{ -This module provides support for building a new version of the -Python executable. This will be necessary on systems that do -not support shared libraries and may be necessary with C++ -extensions. This file contains everything you need to build -a new version of Python from include files and libraries normally -installed with the Python language. - -This module will automatically grab all of the Python modules -present in your current Python executable (including any special -purpose modules you have enabled such as Tkinter). Thus, you -may need to provide additional link libraries when compiling. - -This library file only works with Python 1.5. A version -compatible with Python 1.4 is available as embed14.i and -a Python1.3 version is available as embed13.i. As far as -I know, this module is C++ safe. -%} -#else -%echo "embed.i : Using Python 1.5" -#endif - -%wrapper %{ - -#include