Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Commit

Permalink
Merge upgrade of peep. Close #542.
Browse files Browse the repository at this point in the history
Upgrade peep to version 3.1.2.
  • Loading branch information
erikrose committed May 12, 2016
2 parents 9fd6369 + 39a5bff commit 5f661b9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tooling/peep.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
from urllib.parse import urlparse # 3.4
# TODO: Probably use six to make urllib stuff work across 2/3.

from pkg_resources import require, VersionConflict, DistributionNotFound
from pkg_resources import require, VersionConflict, DistributionNotFound, safe_name

# We don't admit our dependency on pip in setup.py, lest a naive user simply
# say `pip install peep.tar.gz` and thus pull down an untrusted copy of pip
Expand Down Expand Up @@ -86,6 +86,7 @@ def activate(specifier):
from pip.util import url_to_path # 0.7.0
except ImportError:
from pip.util import url_to_filename as url_to_path # 0.6.2
from pip.exceptions import InstallationError
from pip.index import PackageFinder, Link
try:
from pip.log import logger
Expand All @@ -104,7 +105,7 @@ def iter(self, ret, *args, **kwargs):

DownloadProgressBar = DownloadProgressSpinner = NullProgressBar

__version__ = 3, 1, 0
__version__ = 3, 1, 2

try:
from pip.index import FormatControl # noqa
Expand All @@ -122,6 +123,7 @@ def iter(self, ret, *args, **kwargs):
SOMETHING_WENT_WRONG = 1
# "Traditional" for command-line errors according to optparse docs:
COMMAND_LINE_ERROR = 2
UNHANDLED_EXCEPTION = 3

ARCHIVE_EXTENSIONS = ('.tar.bz2', '.tar.gz', '.tgz', '.tar', '.zip')

Expand Down Expand Up @@ -663,6 +665,9 @@ def _project_name(self):
name = getattr(self._req.req, 'project_name', '')
if name:
return name
name = getattr(self._req.req, 'name', '')
if name:
return safe_name(name)
raise ValueError('Requirement has no project_name.')

def _name(self):
Expand Down Expand Up @@ -884,7 +889,7 @@ def peep_install(argv):
first_every_last(buckets[SatisfiedReq], *printers)

return ITS_FINE_ITS_FINE
except (UnsupportedRequirementError, DownloadError) as exc:
except (UnsupportedRequirementError, InstallationError, DownloadError) as exc:
out(str(exc))
return SOMETHING_WENT_WRONG
finally:
Expand Down Expand Up @@ -920,7 +925,7 @@ def peep_port(paths):
if not hashes:
print(req.req)
else:
print('%s' % req.req, end='')
print('%s' % (req.link if getattr(req, 'link', None) else req.req), end='')
for hash in hashes:
print(' \\')
print(' --hash=sha256:%s' % hash, end='')
Expand Down Expand Up @@ -965,4 +970,4 @@ def exception_handler(exc_type, exc_value, exc_tb):
exit(main())
except Exception:
exception_handler(*sys.exc_info())
exit(SOMETHING_WENT_WRONG)
exit(UNHANDLED_EXCEPTION)

0 comments on commit 5f661b9

Please sign in to comment.