Commit 125784d9 authored by Jim Fulton's avatar Jim Fulton

Bug fixed:

  Scripts run using generated interpreters didn't have __file__ set correctly.
parent 21b6e7a7
...@@ -20,6 +20,8 @@ Bugs fixed: ...@@ -20,6 +20,8 @@ Bugs fixed:
- Scripts generated with relative-paths eanbled couldn't be - Scripts generated with relative-paths eanbled couldn't be
symbolocally linked to other locations and still work. symbolocally linked to other locations and still work.
- Scripts run using generated interpreters didn't have __file__ set correctly.
1.4.0 (2009-08-26) 1.4.0 (2009-08-26)
================== ==================
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
This module provides a high-level Python API for installing packages. This module provides a high-level Python API for installing packages.
It doesn't install scripts. It uses setuptools and requires it to be It doesn't install scripts. It uses setuptools and requires it to be
installed. installed.
$Id$
""" """
import distutils.errors import distutils.errors
...@@ -1140,7 +1138,8 @@ if len(sys.argv) > 1: ...@@ -1140,7 +1138,8 @@ if len(sys.argv) > 1:
if _args: if _args:
sys.argv[:] = _args sys.argv[:] = _args
execfile(sys.argv[0]) __file__ = _args[0]
execfile(__file__)
if _interactive: if _interactive:
import code import code
......
...@@ -683,7 +683,8 @@ the path set: ...@@ -683,7 +683,8 @@ the path set:
<BLANKLINE> <BLANKLINE>
if _args: if _args:
sys.argv[:] = _args sys.argv[:] = _args
execfile(sys.argv[0]) __file__ = _args[0]
execfile(__file__)
<BLANKLINE> <BLANKLINE>
if _interactive: if _interactive:
import code import code
...@@ -691,6 +692,15 @@ the path set: ...@@ -691,6 +692,15 @@ the path set:
If invoked with a script name and arguments, it will run that script, instead. If invoked with a script name and arguments, it will run that script, instead.
>>> write('ascript', '''
... "demo doc"
... print sys.argv
... print (__name__, __file__, __doc__)
... ''')
>>> print system(join(bin, 'py')+' ascript a b c'),
['ascript', 'a', 'b', 'c']
('__main__', 'ascript', 'demo doc')
An additional argument can be passed to define which scripts to install An additional argument can be passed to define which scripts to install
and to provide script names. The argument is a dictionary mapping and to provide script names. The argument is a dictionary mapping
original script names to new script names. original script names to new script names.
...@@ -874,7 +884,8 @@ We specified an interpreter and its paths are adjusted too: ...@@ -874,7 +884,8 @@ We specified an interpreter and its paths are adjusted too:
<BLANKLINE> <BLANKLINE>
if _args: if _args:
sys.argv[:] = _args sys.argv[:] = _args
execfile(sys.argv[0]) __file__ = _args[0]
execfile(__file__)
<BLANKLINE> <BLANKLINE>
if _interactive: if _interactive:
import code import code
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment