summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/core.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2008-04-04 05:41:30 (GMT)
committerFred Drake <fdrake@acm.org>2008-04-04 05:41:30 (GMT)
commit46c58c17f18b87f4a3d3d363f171cff1715981d1 (patch)
tree0345b6b8417d022f34863667803b07ca305250bd /Lib/distutils/core.py
parent2b860db35c5346c216672f94031ecc800dbebf02 (diff)
downloadcpython-46c58c17f18b87f4a3d3d363f171cff1715981d1.zip
cpython-46c58c17f18b87f4a3d3d363f171cff1715981d1.tar.gz
cpython-46c58c17f18b87f4a3d3d363f171cff1715981d1.tar.bz2
- Issue #2385: distutils.core.run_script() makes __file__ available, so the
controlled environment will more closely mirror the typical script environment. This supports setup.py scripts that refer to data files.
Diffstat (limited to 'Lib/distutils/core.py')
-rw-r--r--Lib/distutils/core.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py
index c40dd0a..640d6b5 100644
--- a/Lib/distutils/core.py
+++ b/Lib/distutils/core.py
@@ -210,8 +210,9 @@ def run_setup (script_name, script_args=None, stop_after="run"):
_setup_stop_after = stop_after
save_argv = sys.argv
- g = {}
+ g = {'__file__': script_name}
l = {}
+ os.chdir(os.path.dirname(script_name) or os.curdir)
try:
try:
sys.argv[0] = script_name