fsaintjacques commented on a change in pull request #7021:
URL: https://github.com/apache/arrow/pull/7021#discussion_r419809722



##########
File path: dev/archery/archery/cli.py
##########
@@ -30,14 +31,16 @@
 from .utils.codec import JsonEncoder
 from .utils.lint import linter, python_numpydoc, LintValidationException
 from .utils.logger import logger, ctx as log_ctx
-from .utils.source import ArrowSources
+from .utils.source import ArrowSources, InvalidArrowSource
 from .utils.tmpdir import tmpdir
-from .bot import CommentBot, actions
 
 # Set default logging to INFO in command line.
 logging.basicConfig(level=logging.INFO)
 
 
+DEFAULT_ARROW_PATH = Path(__file__).parents[3].absolute()

Review comment:
       Is this used?

##########
File path: dev/archery/archery/docker.py
##########
@@ -0,0 +1,186 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import os
+import subprocess
+
+from dotenv import dotenv_values
+from ruamel.yaml import YAML
+
+from .utils.command import Command, default_bin
+from .compat import _ensure_path
+
+
+def flatten(node, parents=None):
+    parents = list(parents or [])
+    if isinstance(node, str):
+        yield (node, parents)
+    elif isinstance(node, list):
+        for value in node:
+            yield from flatten(value, parents=parents)
+    elif isinstance(node, dict):
+        for key, value in node.items():
+            yield (key, parents)
+            yield from flatten(value, parents=parents + [key])
+    else:
+        raise TypeError(node)
+
+
+class UndefinedImage(Exception):
+    pass
+
+
+class Docker(Command):
+
+    def __init__(self, docker_bin=None):
+        self.bin = default_bin(docker_bin, "docker")
+
+
+class DockerCompose(Command):
+
+    def __init__(self, config_path, dotenv_path=None, compose_bin=None,
+                 params=None):
+        self.config_path = _ensure_path(config_path)
+        if dotenv_path:
+            self.dotenv_path = _ensure_path(dotenv_path)
+        else:
+            self.dotenv_path = self.config_path.parent / '.env'
+
+        yaml = YAML()
+        with self.config_path.open() as fp:
+            self.config = yaml.load(fp)
+
+        self.bin = default_bin(compose_bin, 'docker-compose')
+        self.nodes = dict(flatten(self.config['x-hierarchy']))
+        self.dotenv = dotenv_values(str(self.dotenv_path))
+        if params is None:
+            self.params = {}
+        else:
+            self.params = {k: v for k, v in params.items() if k in self.dotenv}
+
+        # forward the process' environment variables

Review comment:
       The calling process' environment should override the dotenv, it's the 
only way to override a configuration without touching the .env file.
   
   ```
   $ UBUNTU=20.04 archery docker run conda-cpp
   Building conda-cpp
   Step 1/16 : ARG arch=amd64
   Step 2/16 : FROM ${arch}/ubuntu:18.04
    ---> c3c304cb4f22
   Step 3/16 : ARG arch=amd64
    ---> Running in 13411a23c148
   ```
   
   Something is wrong with the unit test too if it didn't catch this issue.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to