diff mbox

docker: Install dependencies for Python 2 also

Message ID BLU437-SMTP73BCBE1BECEBC15168F77EA3E40@phx.gbl
State Accepted
Headers show

Commit Message

Stephen Finucane Sept. 3, 2016, 5:49 p.m. UTC
Aspects of both Patchwork and Django, such as the 'makemigrations'
management command, function differently under Python 3. It should be
possible to run these commands under Python 2. Install dependencies in
the Python 2 environment to make this a possibility.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
---
 tools/docker/Dockerfile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Daniel Axtens Sept. 4, 2016, 11:38 p.m. UTC | #1
Stephen Finucane <stephenfinucane@hotmail.com> writes:

> Aspects of both Patchwork and Django, such as the 'makemigrations'
> management command, function differently under Python 3. It should be
> possible to run these commands under Python 2. Install dependencies in
> the Python 2 environment to make this a possibility.
>
> Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
> ---
>  tools/docker/Dockerfile | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

I'm pretty much OK with this. However, it will weaken some of the Python
3 testing - for example, with this patch I would never have found out
that the parsemail.sh script doesn't work if you've installed Django in
Python 3 only.

(I suspect that pwclient is similarly not being tested in Python3
because it calls out to /usr/bin/env python)

Are there specific differences that we could be testing in tox instead?

Regards,
Daniel

>
> diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
> index b39204c..883d43a 100644
> --- a/tools/docker/Dockerfile
> +++ b/tools/docker/Dockerfile
> @@ -30,9 +30,12 @@ RUN useradd --uid=$UID --create-home patchwork
>  # Python requirements.
>  # If you update requirements, you should rebuild the container.
>  # entrypoint.sh will prompt you to do this.
> +# we install both Python 2 and Python 3 versions so you can use either
>  COPY requirements-*.txt /tmp/
> -RUN pip3  install virtualenv tox && \
> -    pip3  install -r /tmp/requirements-dev.txt
> +RUN pip3 install virtualenv tox && \
> +    pip3 install -r /tmp/requirements-dev.txt
> +RUN pip2 install virtualenv tox && \
> +    pip2 install -r /tmp/requirements-dev.txt
>  # we deliberately leave the requirements files in tmp so we can
>  # ping the user in entrypoint.sh if the change them!
>  
> -- 
> 2.7.4
>
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
Daniel Axtens Sept. 19, 2016, 4:08 a.m. UTC | #2
Stephen Finucane <stephenfinucane@hotmail.com> writes:

> Aspects of both Patchwork and Django, such as the 'makemigrations'
> management command, function differently under Python 3. It should be
> possible to run these commands under Python 2. Install dependencies in
> the Python 2 environment to make this a possibility.
>
> Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>

I've had a change of heart on this after finding the differences with
makemigrations the hard way!

Acked-by: Daniel Axtens <dja@axtens.net>

Regards,
Daniel

> ---
>  tools/docker/Dockerfile | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
> index b39204c..883d43a 100644
> --- a/tools/docker/Dockerfile
> +++ b/tools/docker/Dockerfile
> @@ -30,9 +30,12 @@ RUN useradd --uid=$UID --create-home patchwork
>  # Python requirements.
>  # If you update requirements, you should rebuild the container.
>  # entrypoint.sh will prompt you to do this.
> +# we install both Python 2 and Python 3 versions so you can use either
>  COPY requirements-*.txt /tmp/
> -RUN pip3  install virtualenv tox && \
> -    pip3  install -r /tmp/requirements-dev.txt
> +RUN pip3 install virtualenv tox && \
> +    pip3 install -r /tmp/requirements-dev.txt
> +RUN pip2 install virtualenv tox && \
> +    pip2 install -r /tmp/requirements-dev.txt
>  # we deliberately leave the requirements files in tmp so we can
>  # ping the user in entrypoint.sh if the change them!
>  
> -- 
> 2.7.4
>
> _______________________________________________
> Patchwork mailing list
> Patchwork@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/patchwork
Stephen Finucane Sept. 19, 2016, 11:15 p.m. UTC | #3
On 19 Sep 14:08, Daniel Axtens wrote:
> Stephen Finucane <stephenfinucane@hotmail.com> writes:
> 
> > Aspects of both Patchwork and Django, such as the 'makemigrations'
> > management command, function differently under Python 3. It should be
> > possible to run these commands under Python 2. Install dependencies in
> > the Python 2 environment to make this a possibility.
> >
> > Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
> 
> I've had a change of heart on this after finding the differences with
> makemigrations the hard way!
> 
> Acked-by: Daniel Axtens <dja@axtens.net>

Lovely. Merged.
diff mbox

Patch

diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index b39204c..883d43a 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -30,9 +30,12 @@  RUN useradd --uid=$UID --create-home patchwork
 # Python requirements.
 # If you update requirements, you should rebuild the container.
 # entrypoint.sh will prompt you to do this.
+# we install both Python 2 and Python 3 versions so you can use either
 COPY requirements-*.txt /tmp/
-RUN pip3  install virtualenv tox && \
-    pip3  install -r /tmp/requirements-dev.txt
+RUN pip3 install virtualenv tox && \
+    pip3 install -r /tmp/requirements-dev.txt
+RUN pip2 install virtualenv tox && \
+    pip2 install -r /tmp/requirements-dev.txt
 # we deliberately leave the requirements files in tmp so we can
 # ping the user in entrypoint.sh if the change them!