diff options
| author | Martin v. Löwis <martin@v.loewis.de> | 2009-09-12 17:05:03 +0200 |
|---|---|---|
| committer | Martin v. Löwis <martin@v.loewis.de> | 2009-09-12 17:05:03 +0200 |
| commit | a3efc4cae6bfa2e8a03a7b75380f29c660b876cb (patch) | |
| tree | 5479e2a42eec648a17950562e4bb5b427fb0c8e4 /setuptools/command/easy_install.py | |
| parent | c1098e903f4eab3c673089fb60d3540e28fe0778 (diff) | |
| download | python-setuptools-git-a3efc4cae6bfa2e8a03a7b75380f29c660b876cb.tar.gz | |
Port writing text files to 3.x.
--HG--
branch : distribute
extra : rebase_source : 767d047dae23d5123bf412b5838d150091eea078
Diffstat (limited to 'setuptools/command/easy_install.py')
| -rwxr-xr-x | setuptools/command/easy_install.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 0fa07845..7ed467f0 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -39,6 +39,13 @@ def samefile(p1,p2): os.path.normpath(os.path.normcase(p2)) ) +if sys.version_info <= (3,): + def _to_ascii(s): + return s +else: + def _to_ascii(s): + return s.encode('ascii') + class easy_install(Command): """Manage a download/build/install process""" description = "Find/get/install Python packages" @@ -599,7 +606,7 @@ Please make the appropriate changes for your system and try again. "import pkg_resources\n" "pkg_resources.run_script(%(spec)r, %(script_name)r)\n" ) % locals() - self.write_script(script_name, script_text, 'b') + self.write_script(script_name, _to_ascii(script_text), 'b') def write_script(self, script_name, contents, mode="t", blockers=()): """Write an executable file to the scripts directory""" @@ -1381,7 +1388,7 @@ class PthDistributions(Environment): if os.path.islink(self.filename): os.unlink(self.filename) - f = open(self.filename,'wb') + f = open(self.filename,'wt') f.write(data); f.close() elif os.path.exists(self.filename): |
