Jason R. Coombs avatar Jason R. Coombs committed 9572ef0

Fix issue where easy_install fails on Python 3 on windows installer. Fixes #212

Comments (0)

Files changed (2)

distribute.egg-info/entry_points.txt

 
 [console_scripts]
 easy_install = setuptools.command.easy_install:main
-easy_install-2.6 = setuptools.command.easy_install:main
+easy_install-2.7 = setuptools.command.easy_install:main
 
 [setuptools.file_finders]
 svn_cvs = setuptools.command.sdist:_default_revctrl

setuptools/command/easy_install.py

         f.seek(prepended-(12+cfglen))
         cfg = ConfigParser.RawConfigParser({'version':'','target_version':''})
         try:
-            cfg.readfp(StringIO.StringIO(f.read(cfglen).split(chr(0),1)[0]))
+            part = f.read(cfglen)
+            # part is in bytes, but we need to read up to the first null
+            #  byte.
+            null_byte = bytes([0]) if sys.version_info >= (2,6) else chr(0)
+            config, = part.split(null_byte, 1)
+            # Now the config is in bytes, but on Python 3, it must be
+            #  unicode for the RawConfigParser, so decode it. Is this the
+            #  right encoding?
+            config = config.decode('ascii')
+            cfg.readfp(StringIO.StringIO(config))
         except ConfigParser.Error:
             return None
         if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.