Allow for custom pip flags to be passed to the pip command

This commit allows custom pip flags to be passed on to the pip executable. My usecase was disabling the inclusion of pyc files in the generated package by passing on the --no-compile pip arg.
On Tue, Sep 2, 2014 at 11:44 AM, Jyrki Pulliainen <notifications@github.com>
wrote:

> In dh_virtualenv/deployment.py:
>
> > @@ -111,6 +115,9 @@ def pip(self, *args):
> >          return self.pip_prefix + list(args)
> >
> >      def install_dependencies(self):
> > +        # Add in any user supplied args
> > +        if self.extra_pip_arg:
> > +            self.pip_prefix.append(" ".join(self.extra_pip_arg))
>
> Few other flags, like verbose, are handled above in the create_virtualenv
> method by appending (or in this case, extending) the pip prefix. Could you
> move this there too?
>
Sure, I had the code in create_virtualenv but thought that the function
would probably fit better in install_deps.
Fixed.


> You should probably use extend too, because appending might cause
> mis-quoting in the subprocess, because subprocess will quote, when given an
> array, every element independently e.g. multiple options might end up
> inside same quotes when executing:
>
>     extra_pip_args = ['--no-compile', '--extra-index-url=derp']
>     self.pip_prefix.append(" ".join(extra_pip_args))
>     subprocess.check_call(self.pip_prefix)
>     # This probably results to a call of style: pip --someswitch "--no-compile --extra-index-url=derp"
>
> Unfortunately this behaviour is bit hard to test without actually running
> some commands
>
Aha... nice catch!
Fixed.

> —
> Reply to this email directly or view it on GitHub
> <https://github.com/spotify/dh-virtualenv/pull/58/files#r16975899>.
>