[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: David Glasser <glasser_at_mit.edu>
Date: 2006-12-12 06:41:20 CET

On 12/12/06, Daniel Rall <dlr@collab.net> 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, it can't be moved entirely out of the try block because it uses
sysconfig, but it could be moved to an else: clause on the try block.

--dave

-- 
David Glasser | glasser_at_mit.edu | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Dec 12 06:41:33 2006

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.