Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added: --install-option on requirements file #271 #515

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions pip/req.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
class InstallRequirement(object):

def __init__(self, req, comes_from, source_dir=None, editable=False,
url=None, as_egg=False, update=True):
url=None, as_egg=False, update=True, options=None):
self.extras = ()
if isinstance(req, string_types):
req = pkg_resources.Requirement.parse(req)
Expand All @@ -48,6 +48,7 @@ def __init__(self, req, comes_from, source_dir=None, editable=False,
self.editable = editable
self.url = url
self.as_egg = as_egg
self.options = options
self._egg_info_path = None
# This holds the pkg_resources.Distribution object if this requirement
# is already available:
Expand Down Expand Up @@ -90,6 +91,7 @@ def from_line(cls, name, comes_from=None):
req = None
path = os.path.normpath(os.path.abspath(name))
link = None
options = None

if is_url(name):
link = Link(name)
Expand All @@ -113,9 +115,16 @@ def from_line(cls, name, comes_from=None):
url = path_to_url(os.path.normpath(os.path.abspath(link.path)))

else:
import shlex
line_arguments = shlex.split(name)
if len(line_arguments) > 1:
from pip.commands.install import InstallCommand
parser = InstallCommand().parser
(options, args) = parser.parse_args(line_arguments[1:])
name = line_arguments[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not following why this is just in the else block? and also not supported for editables.
e.g. we wouldn't be supporting install options for any of these forms

http://stuff.com/my_stash/package.tar.gz
git+http://github.com/frank/frodo@tag#egg=frodo
-e git+http://github.com/frank/frodo@tag#egg=frodo

req = name

return cls(req, comes_from, url=url)
return cls(req, comes_from, url=url, options=options)

def __str__(self):
if self.req:
Expand Down Expand Up @@ -558,6 +567,8 @@ def _clean_zip_name(self, name, prefix):
return name

def install(self, install_options, global_options=()):
if self.options and self.options.install_options:
install_options += self.options.install_options
if self.editable:
self.install_editable(install_options, global_options)
return
Expand Down