[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r22625 - in trunk: build/generator subversion/bindings/swig

From: Justin Erenkrantz <justin_at_erenkrantz.com>
Date: 2006-12-12 07:21:32 CET

On Mon, Dec 11, 2006 at 09:34:14PM -0800, Daniel Rall wrote:
> 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?

Well, the issue is that if sysconfig can't be found, then there's no reason to
set python_includes or python_libdir. So, if sysconfig is not found, then none
of the rest of the code should be executed. *shrug* -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Dec 12 07:21:46 2006

This is an archived mail posted to the Subversion Dev mailing list.