On Tue, Mar 18, 2008 at 5:34 PM, Phillip J. Eby <[EMAIL PROTECTED]>
wrote:
> [cut]
> I never could get run_setup() to work robustly.
>
>
> Here's how setuptools does it, and it works well with quite a lot of
> packages:
>
> os.chdir(setup_dir)
> try:
> sys.argv[:] = [setup_script]+list(args)
> sys.path.insert(0, setup_dir)
> DirectorySandbox(setup_dir).run(
> lambda: execfile(
> "setup.py",
> {'__file__':setup_script, '__name__':'__main__'}
> )
> )
> except SystemExit, v:
> if v.args and v.args[0]:
> raise
> # Normal exit, just return
>
> This is actually wrapped in a try-finally that saves and restores
> sys.argv, sys.path, os.chdir(), etc. Have a look at
> setuptools.sandbox.run_setup() for the full source.
>
Cool ! Maybe this could be pushed into distutils ? It looks more like a fix
to me
Tarek
_______________________________________________
Distutils-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/distutils-sig