diff --git a/CHANGES.rst b/CHANGES.rst index f621e57789e261dd26282b73fc0d4326783ff1d4..10808f7d1a0d9f436d336a1f8907e99fb4c585d1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,9 @@ Change History 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 configuration is found. diff --git a/src/zc/buildout/easy_install.py b/src/zc/buildout/easy_install.py index 49a90c85d2b897a9d5373df630675c1da9c13838..ef69edb89c0c4b647abe3285969bb8ede376abd1 100644 --- a/src/zc/buildout/easy_install.py +++ b/src/zc/buildout/easy_install.py @@ -1268,9 +1268,8 @@ if len(sys.argv) > 1: sys.argv[:] = _args __file__ = _args[0] del _options, _args - __file__f = open(__file__) - exec(compile(__file__f.read(), __file__, "exec")) - __file__f.close(); del __file__f + with open(__file__, 'U') as __file__f: + exec(compile(__file__f.read(), __file__, "exec")) if _interactive: del _interactive @@ -1289,7 +1288,8 @@ __file__ = %(__file__)r os.chdir(%(setupdir)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')) """