From 8ad4c08109f4ec45985b10fa9cf0482d9361c886 Mon Sep 17 00:00:00 2001 From: Christopher Crone Date: Tue, 5 Feb 2019 10:40:03 +0100 Subject: [PATCH 1/5] macOS: Bump Python and OpenSSL Signed-off-by: Christopher Crone --- script/setup/osx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/setup/osx b/script/setup/osx index 08491b6e5..1b546816d 100755 --- a/script/setup/osx +++ b/script/setup/osx @@ -13,13 +13,13 @@ if ! [ ${DEPLOYMENT_TARGET} == "$(macos_version)" ]; then SDK_SHA1=dd228a335194e3392f1904ce49aff1b1da26ca62 fi -OPENSSL_VERSION=1.1.0h +OPENSSL_VERSION=1.1.0j OPENSSL_URL=https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz -OPENSSL_SHA1=0fc39f6aa91b6e7f4d05018f7c5e991e1d2491fd +OPENSSL_SHA1=dcad1efbacd9a4ed67d4514470af12bbe2a1d60a -PYTHON_VERSION=3.6.6 +PYTHON_VERSION=3.6.8 PYTHON_URL=https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz -PYTHON_SHA1=ae1fc9ddd29ad8c1d5f7b0d799ff0787efeb9652 +PYTHON_SHA1=09fcc4edaef0915b4dedbfb462f1cd15f82d3a6f # # Install prerequisites. From b572b3299995c54189c0ec66ed39b6fc288cb98f Mon Sep 17 00:00:00 2001 From: Christopher Crone Date: Tue, 5 Feb 2019 10:50:25 +0100 Subject: [PATCH 2/5] requirements-dev: Fix version of mock to 2.0.0 Signed-off-by: Christopher Crone --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index d49ce49c4..b19fc2e01 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,6 @@ coverage==4.4.2 ddt==1.2.0 flake8==3.5.0 -mock>=1.0.1 +mock==2.0.0 pytest==3.6.3 pytest-cov==2.5.1 From f1f0894c1bee49585166d0dc6045ca9742eeb83b Mon Sep 17 00:00:00 2001 From: Christopher Crone Date: Tue, 5 Feb 2019 10:50:55 +0100 Subject: [PATCH 3/5] script.build.linux: Do not tail image build logs Signed-off-by: Christopher Crone --- script/build/linux | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/build/linux b/script/build/linux index 1a4cd4d9b..056940ad0 100755 --- a/script/build/linux +++ b/script/build/linux @@ -5,7 +5,7 @@ set -ex ./script/clean TAG="docker-compose" -docker build -t "$TAG" . | tail -n 200 +docker build -t "$TAG" . docker run \ --rm --entrypoint="script/build/linux-entrypoint" \ -v $(pwd)/dist:/code/dist \ From f472fd545be79860a3c9e03b6e63fbacb86977d1 Mon Sep 17 00:00:00 2001 From: Christopher Crone Date: Tue, 5 Feb 2019 10:51:26 +0100 Subject: [PATCH 4/5] Dockerfile: Force version of virtualenv to 16.2.0 Signed-off-by: Christopher Crone --- Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Dockerfile b/Dockerfile index a14be492e..c5e7c815a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,8 @@ ENV LANG en_US.UTF-8 RUN useradd -d /home/user -m -s /bin/bash user WORKDIR /code/ +# FIXME(chris-crone): virtualenv 16.3.0 breaks build, force 16.2.0 until fixed +RUN pip install virtualenv==16.2.0 RUN pip install tox==2.1.1 ADD requirements.txt /code/ @@ -25,6 +27,7 @@ ADD .pre-commit-config.yaml /code/ ADD setup.py /code/ ADD tox.ini /code/ ADD compose /code/compose/ +ADD README.md /code/ RUN tox --notest ADD . /code/ From c8a621b637a7574b621e919b849d56fa66c3d996 Mon Sep 17 00:00:00 2001 From: Ulysses Souza Date: Wed, 30 Jan 2019 14:28:00 +0100 Subject: [PATCH 5/5] Fix Flake8 lint This removes extra indentation and replace the use of `is` by `==` when comparing strings Signed-off-by: Ulysses Souza --- compose/service.py | 80 +++++++++++++++--------------- tests/unit/cli/log_printer_test.py | 2 +- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/compose/service.py b/compose/service.py index 59f05f8dc..401efa7eb 100644 --- a/compose/service.py +++ b/compose/service.py @@ -291,7 +291,7 @@ class Service(object): c for c in stopped_containers if self._containers_have_diverged([c]) ] for c in divergent_containers: - c.remove() + c.remove() all_containers = list(set(all_containers) - set(divergent_containers)) @@ -467,50 +467,50 @@ class Service(object): def _execute_convergence_recreate(self, containers, scale, timeout, detached, start, renew_anonymous_volumes): - if scale is not None and len(containers) > scale: - self._downscale(containers[scale:], timeout) - containers = containers[:scale] + if scale is not None and len(containers) > scale: + self._downscale(containers[scale:], timeout) + containers = containers[:scale] - def recreate(container): - return self.recreate_container( - container, timeout=timeout, attach_logs=not detached, - start_new_container=start, renew_anonymous_volumes=renew_anonymous_volumes - ) - containers, errors = parallel_execute( - containers, - recreate, - lambda c: c.name, - "Recreating", + def recreate(container): + return self.recreate_container( + container, timeout=timeout, attach_logs=not detached, + start_new_container=start, renew_anonymous_volumes=renew_anonymous_volumes ) + containers, errors = parallel_execute( + containers, + recreate, + lambda c: c.name, + "Recreating", + ) + for error in errors.values(): + raise OperationFailedError(error) + + if scale is not None and len(containers) < scale: + containers.extend(self._execute_convergence_create( + scale - len(containers), detached, start + )) + return containers + + def _execute_convergence_start(self, containers, scale, timeout, detached, start): + if scale is not None and len(containers) > scale: + self._downscale(containers[scale:], timeout) + containers = containers[:scale] + if start: + _, errors = parallel_execute( + containers, + lambda c: self.start_container_if_stopped(c, attach_logs=not detached, quiet=True), + lambda c: c.name, + "Starting", + ) + for error in errors.values(): raise OperationFailedError(error) - if scale is not None and len(containers) < scale: - containers.extend(self._execute_convergence_create( - scale - len(containers), detached, start - )) - return containers - - def _execute_convergence_start(self, containers, scale, timeout, detached, start): - if scale is not None and len(containers) > scale: - self._downscale(containers[scale:], timeout) - containers = containers[:scale] - if start: - _, errors = parallel_execute( - containers, - lambda c: self.start_container_if_stopped(c, attach_logs=not detached, quiet=True), - lambda c: c.name, - "Starting", - ) - - for error in errors.values(): - raise OperationFailedError(error) - - if scale is not None and len(containers) < scale: - containers.extend(self._execute_convergence_create( - scale - len(containers), detached, start - )) - return containers + if scale is not None and len(containers) < scale: + containers.extend(self._execute_convergence_create( + scale - len(containers), detached, start + )) + return containers def _downscale(self, containers, timeout=None): def stop_and_remove(container): diff --git a/tests/unit/cli/log_printer_test.py b/tests/unit/cli/log_printer_test.py index d0c4b56be..6db24e464 100644 --- a/tests/unit/cli/log_printer_test.py +++ b/tests/unit/cli/log_printer_test.py @@ -193,7 +193,7 @@ class TestConsumeQueue(object): queue.put(item) generator = consume_queue(queue, True) - assert next(generator) is 'foobar-1' + assert next(generator) == 'foobar-1' def test_item_is_none_when_timeout_is_hit(self): queue = Queue()