[Python-checkins] python/nondist/sandbox/setuptools/setuptools __init__.py, 1.7, 1.8 package_index.py, 1.4, 1.5
pje@users.sourceforge.net
pje at users.sourceforge.net
Wed Jun 15 04:23:50 CEST 2005
- Previous message: [Python-checkins] python/nondist/sandbox/setuptools EasyInstall.txt, 1.13, 1.14 easy_install.py, 1.21, 1.22 ez_setup.py, 1.4, 1.5 setup.py, 1.14, 1.15
- Next message: [Python-checkins] python/nondist/sandbox/setuptools/setuptools package_index.py, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14136/setuptools
Modified Files:
__init__.py package_index.py
Log Message:
Add support for installing from .win32.exe's created by distutils (by
converting them to eggs). Bump version to 0.5a1.
Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/__init__.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- __init__.py 15 Jun 2005 02:19:42 -0000 1.7
+++ __init__.py 15 Jun 2005 02:23:48 -0000 1.8
@@ -8,7 +8,7 @@
from distutils.util import convert_path
import os.path
-__version__ = '0.4a4'
+__version__ = '0.5a1'
__all__ = [
'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require',
Index: package_index.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/package_index.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- package_index.py 14 Jun 2005 15:30:31 -0000 1.4
+++ package_index.py 15 Jun 2005 02:23:48 -0000 1.5
@@ -9,13 +9,25 @@
EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz".split()
__all__ = [
- 'PackageIndex', 'distros_for_url',
+ 'PackageIndex', 'distros_for_url', 'parse_bdist_wininst',
+ 'interpret_distro_name',
]
+def parse_bdist_wininst(name):
+ """Return (base,pyversion) or (None,None) for possible .exe name"""
+ lower = name.lower()
+ base, py_ver = None, None
+ if lower.endswith('.exe'):
+ if lower.endswith('.win32.exe'):
+ base = name[:-10]
+ elif lower[-16:].startswith('.win32-py'):
+ py_ver = base[-7:-4]
+ base = name[:-16]
+ return base,py_ver
@@ -27,8 +39,32 @@
+def distros_for_url(url, metadata=None):
+ """Yield egg or source distribution objects that might be found at a URL"""
+ path = urlparse.urlparse(url)[2]
+ base = urllib2.unquote(path.split('/')[-1])
+
+ if base.endswith('.egg'):
+ dist = Distribution.from_filename(base, metadata)
+ dist.path = url
+ return [dist] # only one, unambiguous interpretation
+ if base.endswith('.exe'):
+ win_base, py_ver = parse_bdist_wininst(name)
+ if win_base is not None:
+ return interpret_distro_name(
+ url, win_base, metadata, py_ver, BINARY_DIST, "win32"
+ )
+
+ # Try source distro extensions (.zip, .tgz, etc.)
+ #
+ for ext in EXTENSIONS:
+ if base.endswith(ext):
+ base = base[:-len(ext)]
+ return interpret_distro_name(url, base, metadata)
+
+ return [] # no extension matched
@@ -39,24 +75,14 @@
-def distros_for_url(url, metadata=None):
- """Yield egg or source distribution objects that might be found at a URL"""
- path = urlparse.urlparse(url)[2]
- base = urllib2.unquote(path.split('/')[-1])
- if base.endswith('.egg'):
- dist = Distribution.from_filename(base, metadata)
- dist.path = url
- yield dist
- return # only one, unambiguous interpretation
- for ext in EXTENSIONS:
- if base.endswith(ext):
- base = base[:-len(ext)]
- break
- else:
- return # no extension matched
+
+
+def interpret_distro_name(url, base, metadata,
+ py_version=None, distro_type=SOURCE_DIST, platform=None
+):
# Generate alternative interpretations of a source distro name
# Because some packages are ambiguous as to name/versions split
@@ -74,12 +100,27 @@
for p in range(1,len(parts)+1):
yield Distribution(
url, metadata, '-'.join(parts[:p]), '-'.join(parts[p:]),
- distro_type = SOURCE_DIST
+ py_version=py_version, distro_type = distro_type,
+ platform = platform
)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
class PackageIndex(AvailableDistributions):
"""A distribution index that scans web pages for download URLs"""
- Previous message: [Python-checkins] python/nondist/sandbox/setuptools EasyInstall.txt, 1.13, 1.14 easy_install.py, 1.21, 1.22 ez_setup.py, 1.4, 1.5 setup.py, 1.14, 1.15
- Next message: [Python-checkins] python/nondist/sandbox/setuptools/setuptools package_index.py, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-checkins
mailing list