カテゴリー
Uncategorized

[Python] setuptools が上手く動かないことがある件

setuptools はきたねえコードだなあ

x64 とか対応してんのか?

--- package_index.py.orig       Wed Sep 24 12:10:36 2008
+++ package_index.py    Tue Jul 07 10:13:17 2009
@@ -27,17 +27,24 @@
def parse_bdist_wininst(name):
"""Return (base,pyversion) or (None,None) for possible .exe name"""
-    lower = name.lower()
-    base, py_ver = None, None
+    name = name.lower()
-    if lower.endswith('.exe'):
-        if lower.endswith('.win32.exe'):
-            base = name[:-10]
-        elif lower.startswith('.win32-py',-16):
-            py_ver = name[-7:-4]
-            base = name[:-16]
+    # get supported python version
+    r = re.search('py(thon)?(\d)\.?(\d)', name)
+    if not r:
+        return None, None
+    pyversion = '.'.join(r.groups()[1:])
+
+    # strip python version info
+    name = name[:r.start()]
-    return base,py_ver
+    # get the package name and version
+    r = re.match('\w+\W+[\d.]*\d', name)
+    if not r:
+        return None, None
+    base = r.group()
+
+    return base, pyversion
def egg_info_for_url(url):
scheme, server, path, parameters, query, fragment = urlparse.urlparse(url)
@@ -635,6 +642,18 @@
os.unlink(filename)
return self._download_svn(url, filename)
break   # not an index page
+
+        # Handle a manual redirection
+        dlname = urlparse.urlparse(url).path.rsplit('/', 1)[-1]
+        file.seek(0)
+        r = re.search('[^"]+%s' % dlname, file.read())
+        if r:
+            url = r.group()
+            file.close()
+            os.unlink(filename)
+            self._download_to(url, filename)
+            return filename
+
file.close()
os.unlink(filename)
raise DistutilsError("Unexpected HTML page found at "+url)

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です