Commit 8cc0d5c2 authored by PJ Eby's avatar PJ Eby

Fix bugs reported by Ian Bicking, Walter Doerwald, and Vincenzo Di Massa.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041189
parent 647153e6
...@@ -1794,8 +1794,8 @@ class Distribution(object): ...@@ -1794,8 +1794,8 @@ class Distribution(object):
self._version = safe_version(line.split(':',1)[1].strip()) self._version = safe_version(line.split(':',1)[1].strip())
return self._version return self._version
else: else:
raise AttributeError( raise ValueError(
"Missing 'Version:' header in PKG-INFO", self "Missing 'Version:' header and/or PKG-INFO file", self
) )
version = property(version) version = property(version)
......
...@@ -39,7 +39,7 @@ class build_py(_build_py): ...@@ -39,7 +39,7 @@ class build_py(_build_py):
def get_data_files(self): def get_data_files(self):
"""Generate list of '(package,src_dir,build_dir,filenames)' tuples""" """Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
data = [] data = []
for package in self.packages: for package in self.packages or ():
# Locate package source directory # Locate package source directory
src_dir = self.get_package_dir(package) src_dir = self.get_package_dir(package)
......
...@@ -269,7 +269,6 @@ class easy_install(Command): ...@@ -269,7 +269,6 @@ class easy_install(Command):
"%r already exists in %s; can't do a checkout there" % "%r already exists in %s; can't do a checkout there" %
(spec.key, self.build_directory) (spec.key, self.build_directory)
) )
...@@ -281,7 +280,8 @@ class easy_install(Command): ...@@ -281,7 +280,8 @@ class easy_install(Command):
...@@ -381,7 +381,7 @@ class easy_install(Command): ...@@ -381,7 +381,7 @@ class easy_install(Command):
if dist not in requirement: if dist not in requirement:
return return
if deps or self.always_copy: if deps or self.always_copy:
log.info("Processing dependencies for %s", requirement) log.info("Processing dependencies for %s", requirement)
else: else:
return return
...@@ -448,7 +448,7 @@ class easy_install(Command): ...@@ -448,7 +448,7 @@ class easy_install(Command):
setup_base = dist_filename setup_base = dist_filename
ensure_directory(dst); shutil.move(setup_base, dst) ensure_directory(dst); shutil.move(setup_base, dst)
return dst return dst
def install_script(self, dist, script_name, script_text, dev_path=None): def install_script(self, dist, script_name, script_text, dev_path=None):
log.info("Installing %s script to %s", script_name,self.script_dir) log.info("Installing %s script to %s", script_name,self.script_dir)
target = os.path.join(self.script_dir, script_name) target = os.path.join(self.script_dir, script_name)
...@@ -502,10 +502,11 @@ class easy_install(Command): ...@@ -502,10 +502,11 @@ class easy_install(Command):
if os.path.isfile(dist_filename): if os.path.isfile(dist_filename):
unpack_archive(dist_filename, tmpdir, self.unpack_progress) unpack_archive(dist_filename, tmpdir, self.unpack_progress)
elif os.path.isdir(dist_filename): elif os.path.isdir(dist_filename):
# note that setup_base==tmpdir here if this is a svn checkout
setup_base = os.path.abspath(dist_filename) setup_base = os.path.abspath(dist_filename)
if setup_base==tmpdir and self.build_directory and spec is not None: if (setup_base.startswith(tmpdir) # something we downloaded
and self.build_directory and spec is not None
):
setup_base = self.maybe_move(spec, dist_filename, setup_base) setup_base = self.maybe_move(spec, dist_filename, setup_base)
# Find the setup.py file # Find the setup.py file
...@@ -530,7 +531,6 @@ class easy_install(Command): ...@@ -530,7 +531,6 @@ class easy_install(Command):
else: else:
return self.build_and_install(setup_script, setup_base) return self.build_and_install(setup_script, setup_base)
def egg_distribution(self, egg_path): def egg_distribution(self, egg_path):
if os.path.isdir(egg_path): if os.path.isdir(egg_path):
metadata = PathMetadata(egg_path,os.path.join(egg_path,'EGG-INFO')) metadata = PathMetadata(egg_path,os.path.join(egg_path,'EGG-INFO'))
...@@ -1091,7 +1091,7 @@ class PthDistributions(Environment): ...@@ -1091,7 +1091,7 @@ class PthDistributions(Environment):
self.paths.pop() # skip it self.paths.pop() # skip it
self.dirty = True # we cleaned up, so we're dirty now :) self.dirty = True # we cleaned up, so we're dirty now :)
continue continue
seen[path] = 1 seen[path] = 1
while self.paths and not self.paths[-1].strip(): self.paths.pop() while self.paths and not self.paths[-1].strip(): self.paths.pop()
......
...@@ -7,6 +7,8 @@ from distutils.errors import DistutilsError ...@@ -7,6 +7,8 @@ from distutils.errors import DistutilsError
EGG_FRAGMENT = re.compile('^egg=(\\w+(-\\w+)?)$') EGG_FRAGMENT = re.compile('^egg=(\\w+(-\\w+)?)$')
HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I) HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I)
# this is here to fix emacs' cruddy broken syntax highlighting: '
URL_SCHEME = re.compile('([-+.a-z0-9]{2,}):',re.I).match URL_SCHEME = re.compile('([-+.a-z0-9]{2,}):',re.I).match
EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz".split() EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz".split()
...@@ -37,8 +39,6 @@ def parse_bdist_wininst(name): ...@@ -37,8 +39,6 @@ def parse_bdist_wininst(name):
def distros_for_url(url, metadata=None): def distros_for_url(url, metadata=None):
"""Yield egg or source distribution objects that might be found at a URL""" """Yield egg or source distribution objects that might be found at a URL"""
...@@ -371,10 +371,10 @@ class PackageIndex(Environment): ...@@ -371,10 +371,10 @@ class PackageIndex(Environment):
def _download_to(self, url, filename): def _download_to(self, url, filename):
self.info("Downloading %s", url) self.info("Downloading %s", url)
# Download the file # Download the file
fp, tfp = None, None fp, tfp = None, None
try: try:
url = url.split('#', 1)[0]
fp = self.open_url(url) fp = self.open_url(url)
if isinstance(fp, urllib2.HTTPError): if isinstance(fp, urllib2.HTTPError):
raise DistutilsError( raise DistutilsError(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment