On Sat, 09 Dec 2006, jerenkrantz@tigris.org wrote:
...
> Auto-detect the Python include and library dirs on Win32 for SWIG's use.
>
> * build/generator/gen_win.py
> (__init__): Discover our Python options.
> (get_win_includes): Add in our Python include directories.
> (get_win_lib_dirs): Add in our Python library directory for Win32.
> (_find_python): Ask distutils.sysconfig where we can find our dirs.
> * subversion/bindings/swig/INSTALL: Update documentation with helpful notes.
...
> --- trunk/build/generator/gen_win.py (original)
> +++ trunk/build/generator/gen_win.py Sat Dec 9 12:52:34 2006
...
> @@ -940,6 +950,21 @@
> finally:
> fp.close()
>
> + def _find_python(self):
> + "Find the appropriate options for creating SWIG-based Python modules"
> + self.python_includes = []
> + self.python_libdir = ""
> + try:
> + from distutils import sysconfig
> + inc = sysconfig.get_python_inc()
> + plat = sysconfig.get_python_inc(plat_specific=1)
> + self.python_includes.append(inc)
> + if inc != plat:
> + self.python_includes.append(plat)
> + self.python_libdir = self.apath(sysconfig.PREFIX, "libs")
> + except ImportError:
> + pass
...
Does the majority of that method need to be in the "try" block
(e.g. because sysconfig API internally may perform import which could
throw ImportError), or does only the "from distutils import sysconfig"
need to be enclosed by it?
- application/pgp-signature attachment: stored
Received on Tue Dec 12 06:35:45 2006