Commit 23c77f0c authored by Tres Seaver's avatar Tres Seaver

Merge pull request #150 from buildout/issue_130

Open files for 'exec()' w/ universal newlines.
parents e6aa39a2 ceb7f7ea
...@@ -4,6 +4,9 @@ Change History ...@@ -4,6 +4,9 @@ Change History
Unreleased Unreleased
========== ==========
- Open files for ``exec()`` in universal newlines mode. See
https://github.com/buildout/buildout/issues/130
- Add BUILDOUT_HOME as an alternate way to control how the user default - Add BUILDOUT_HOME as an alternate way to control how the user default
configuration is found. configuration is found.
......
...@@ -1268,9 +1268,8 @@ if len(sys.argv) > 1: ...@@ -1268,9 +1268,8 @@ if len(sys.argv) > 1:
sys.argv[:] = _args sys.argv[:] = _args
__file__ = _args[0] __file__ = _args[0]
del _options, _args del _options, _args
__file__f = open(__file__) with open(__file__, 'U') as __file__f:
exec(compile(__file__f.read(), __file__, "exec")) exec(compile(__file__f.read(), __file__, "exec"))
__file__f.close(); del __file__f
if _interactive: if _interactive:
del _interactive del _interactive
...@@ -1289,7 +1288,8 @@ __file__ = %(__file__)r ...@@ -1289,7 +1288,8 @@ __file__ = %(__file__)r
os.chdir(%(setupdir)r) os.chdir(%(setupdir)r)
sys.argv[0] = %(setup)r sys.argv[0] = %(setup)r
exec(compile(open(%(setup)r).read(), %(setup)r, 'exec')) with open(%(setup)r, 'U') as f:
exec(compile(f.read(), %(setup)r, 'exec'))
""" """
......
...@@ -614,7 +614,7 @@ run other scripts with the path set on the working set: ...@@ -614,7 +614,7 @@ run other scripts with the path set on the working set:
The py script simply runs the Python interactive interpreter with The py script simply runs the Python interactive interpreter with
the path set: the path set:
>>> cat(bin, 'py') # doctest: +NORMALIZE_WHITESPACE >>> cat(bin, 'py') # doctest: +NORMALIZE_WHITESPACE +REPORT_NDIFF
#!/usr/local/bin/python2.7 #!/usr/local/bin/python2.7
<BLANKLINE> <BLANKLINE>
import sys import sys
...@@ -643,9 +643,8 @@ the path set: ...@@ -643,9 +643,8 @@ the path set:
sys.argv[:] = _args sys.argv[:] = _args
__file__ = _args[0] __file__ = _args[0]
del _options, _args del _options, _args
__file__f = open(__file__) with open(__file__, 'U') as __file__f:
exec(compile(__file__f.read(), __file__, "exec")) exec(compile(__file__f.read(), __file__, "exec"))
__file__f.close(); del __file__f
<BLANKLINE> <BLANKLINE>
if _interactive: if _interactive:
del _interactive del _interactive
...@@ -872,7 +871,7 @@ Of course, running the script works: ...@@ -872,7 +871,7 @@ Of course, running the script works:
We specified an interpreter and its paths are adjusted too: We specified an interpreter and its paths are adjusted too:
>>> cat(bo, 'bin', 'py') # doctest: +NORMALIZE_WHITESPACE >>> cat(bo, 'bin', 'py') # doctest: +NORMALIZE_WHITESPACE +REPORT_NDIFF
#!/usr/local/bin/python2.7 #!/usr/local/bin/python2.7
<BLANKLINE> <BLANKLINE>
import os import os
...@@ -909,9 +908,8 @@ We specified an interpreter and its paths are adjusted too: ...@@ -909,9 +908,8 @@ We specified an interpreter and its paths are adjusted too:
sys.argv[:] = _args sys.argv[:] = _args
__file__ = _args[0] __file__ = _args[0]
del _options, _args del _options, _args
__file__f = open(__file__) with open(__file__, 'U') as __file__f:
exec(compile(__file__f.read(), __file__, "exec")) exec(compile(__file__f.read(), __file__, "exec"))
__file__f.close(); del __file__f
<BLANKLINE> <BLANKLINE>
if _interactive: if _interactive:
del _interactive del _interactive
......
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