From 96914545e1dfaca19e542dc4944b40fb2325b49a Mon Sep 17 00:00:00 2001 From: paugier Date: Wed, 9 Sep 2020 18:10:19 +0200 Subject: [PATCH] Update Dockerfile (ALPINE_VERSION=3.12.0 & install mercurial) + remove mercurial from install_requires --- Dockerfile | 12 ++++++++---- repo2docker/contentproviders/mercurial.py | 17 +++-------------- setup.py | 2 -- 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 84762c24..023d148b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -ARG ALPINE_VERSION=3.9.4 +ARG ALPINE_VERSION=3.12.0 FROM alpine:${ALPINE_VERSION} -RUN apk add --no-cache git python3 python3-dev +RUN apk add --no-cache git python3 python3-dev py-pip # build wheels in first image ADD . /tmp/src @@ -15,8 +15,12 @@ RUN mkdir /tmp/wheelhouse \ FROM alpine:${ALPINE_VERSION} -# install python, git, bash -RUN apk add --no-cache git git-lfs python3 bash docker +# install python, git, bash, mercurial +RUN apk add --no-cache git git-lfs python3 py-pip bash docker mercurial + +# install and activate the evolve and topic Mercurial extensions +RUN pip3 install hg-evolve --user --no-cache-dir +RUN mkdir -p /etc/mercurial/hgrc.d && echo -e "[extensions]\nevolve =\ntopic =\n" > /etc/mercurial/hgrc.d/evolve.rc # install repo2docker COPY --from=0 /tmp/wheelhouse /tmp/wheelhouse diff --git a/repo2docker/contentproviders/mercurial.py b/repo2docker/contentproviders/mercurial.py index 4d02c1fb..2b33d23f 100644 --- a/repo2docker/contentproviders/mercurial.py +++ b/repo2docker/contentproviders/mercurial.py @@ -4,16 +4,6 @@ from .base import ContentProvider, ContentProviderException from ..utils import execute_cmd -hg_config = [ - "--config", - "extensions.hggit=!", - "--config", - "extensions.evolve=", - "--config", - "extensions.topic=", -] - - class Mercurial(ContentProvider): """Provide contents of a remote Mercurial repository.""" @@ -22,7 +12,8 @@ class Mercurial(ContentProvider): return None try: subprocess.check_output( - ["hg", "identify", source] + hg_config, stderr=subprocess.DEVNULL, + ["hg", "identify", source, "--config", "extensions.hggit=!"], + stderr=subprocess.DEVNULL, ) except subprocess.CalledProcessError: return None @@ -36,7 +27,6 @@ class Mercurial(ContentProvider): # make a clone of the remote repository try: cmd = ["hg", "clone", repo, output_dir] - cmd.extend(hg_config) if ref is not None: # don't update so the clone will include an empty working # directory, the given ref will be updated out later @@ -55,7 +45,7 @@ class Mercurial(ContentProvider): if ref is not None: try: for line in execute_cmd( - ["hg", "update", "--clean", ref] + hg_config, + ["hg", "update", "--clean", ref], cwd=output_dir, capture=yield_output, ): @@ -67,7 +57,6 @@ class Mercurial(ContentProvider): raise ValueError("Failed to update to ref {}".format(ref)) cmd = ["hg", "identify", "-i"] - cmd.extend(hg_config) sha1 = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=output_dir) self._node_id = sha1.stdout.read().decode().strip() diff --git a/setup.py b/setup.py index f41cea0e..5084b486 100644 --- a/setup.py +++ b/setup.py @@ -55,8 +55,6 @@ setup( "ruamel.yaml>=0.15", "toml", "semver", - "mercurial>=5.2", - "hg-evolve>=10.0", ], python_requires=">=3.6", author="Project Jupyter Contributors",