1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Fixed issue #151 -- When running the install command, bail early if no requirement is given.

This commit is contained in:
Jannis Leidel 2010-08-31 03:01:03 +02:00
parent a5785e066f
commit 2f44bcd392
3 changed files with 13 additions and 3 deletions

View file

@ -200,11 +200,18 @@ class InstallCommand(Command):
for req in parse_requirements(filename, finder=finder, options=options):
requirement_set.add_requirement(req)
if not requirement_set.has_requirements:
if options.find_links:
raise InstallationError('You must give at least one '
'requirement to %s (maybe you meant "pip install %s"?)'
% (self.name, " ".join(options.find_links)))
raise InstallationError('You must give at least one '
'requirement to %s (see "pip help install")' % self.name)
if (options.use_user_site and
sys.version_info < (2, 6)):
raise InstallationError('--user is only supported in Python version 2.6 and newer')
import setuptools
if (options.use_user_site and
requirement_set.has_editables and

View file

@ -774,6 +774,10 @@ class RequirementSet(object):
return True
return False
@property
def has_requirements(self):
return self.requirements.values() or self.unnamed_requirements
@property
def has_editables(self):
if any(req.editable for req in self.requirements.values()):

View file

@ -15,7 +15,6 @@ import getpass
from pip.basecommand import get_proxy
from test_pip import here
def new_getpass(prompt, answer='passwd'):
print '%s%s' % (prompt, answer)
return answer