You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ar...@apache.org on 2022/05/25 21:39:10 UTC

[tvm] 07/09: Fix all scripts which reference python3 in the docker containers.

This is an automated email from the ASF dual-hosted git repository.

areusch pushed a commit to branch areusch/freeze-dependencies
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit 00a2568617662eb0574eed27eaa2f425b8f367ba
Author: Andrew Reusch <ar...@gmail.com>
AuthorDate: Mon May 23 18:33:03 2022 -0700

    Fix all scripts which reference python3 in the docker containers.
---
 tests/lint/blocklint.sh        |  6 ++++--
 tests/lint/cpplint.sh          |  4 ++--
 tests/lint/filter_untracked.py | 17 ++---------------
 tests/lint/flake8.sh           |  2 +-
 tests/lint/jnilint.sh          |  2 +-
 tests/lint/pylint.sh           |  7 ++++---
 6 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/tests/lint/blocklint.sh b/tests/lint/blocklint.sh
index 7525bfa64c..9222ef82d1 100755
--- a/tests/lint/blocklint.sh
+++ b/tests/lint/blocklint.sh
@@ -25,8 +25,10 @@ do
   if ! [ "$dir" == "3rdparty" ]; then
     for subdir in $(find $dir -type d -print)
     do
-      blocklint --blocklist blacklist,whitelist,white\ box,master\ ,\ master,master_,_master,slave $subdir \
-      --skip-files tests/lint/blocklint.sh,tests/lint/pylintrc,conda/recipe/meta.yaml,rust/tvm-sys/build.rs,docs/topic/vta/dev/hardware.rst,src/target/source/codegen_vhls.cc,tests/micro/zephyr/test_utils.py
+        "${TVM_VENV}/bin/blocklint" \
+            --blocklist blacklist,whitelist,white\ box,master\ ,\ master,master_,_master,slave \
+            $subdir \
+            --skip-files tests/lint/blocklint.sh,tests/lint/pylintrc,conda/recipe/meta.yaml,rust/tvm-sys/build.rs,docs/topic/vta/dev/hardware.rst,src/target/source/codegen_vhls.cc,tests/micro/zephyr/test_utils.py
     done
   fi
 done
diff --git a/tests/lint/cpplint.sh b/tests/lint/cpplint.sh
index 6c01f0eb0a..34908ff6df 100755
--- a/tests/lint/cpplint.sh
+++ b/tests/lint/cpplint.sh
@@ -19,8 +19,8 @@
 set -e
 
 echo "Running 2 cpplints (VTA and TVM)..."
-python3 3rdparty/dmlc-core/scripts/lint.py --quiet vta cpp vta/include vta/src
-python3 3rdparty/dmlc-core/scripts/lint.py --quiet tvm cpp \
+"${TVM_VENV}/bin/python3" 3rdparty/dmlc-core/scripts/lint.py --quiet vta cpp vta/include vta/src
+"${TVM_VENV}/bin/python3" 3rdparty/dmlc-core/scripts/lint.py --quiet tvm cpp \
 	include src \
 	examples/extension/src examples/graph_executor/src \
 	tests/cpp tests/crt \
diff --git a/tests/lint/filter_untracked.py b/tests/lint/filter_untracked.py
index 3227bc3f18..70dc898a51 100644
--- a/tests/lint/filter_untracked.py
+++ b/tests/lint/filter_untracked.py
@@ -22,27 +22,14 @@ import subprocess
 import sys
 
 
-def check_output(args, **kw):
-    proc = subprocess.Popen(args, **kw, stdout=subprocess.PIPE)
-    out, _ = proc.communicate()
-    if proc.returncode:
-        sys.stderr.write("exited with code %d: %s\n" % (proc.returncode, " ".join(args)))
-        sys.exit(2)
-
-    if sys.version_info[0] == 2:
-        return unicode(out, "utf-8")
-    else:
-        return str(out, "utf-8")
-
-
 def main():
     script_dir = os.path.dirname(__file__) or os.getcwd()
-    toplevel_dir = check_output(["git", "rev-parse", "--show-toplevel"], cwd=script_dir).strip("\n")
+    toplevel_dir = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], cwd=script_dir).strip("\n")
     # NOTE: --ignore-submodules because this can drag in some problems related to mounting a git
     # worktree in the docker VM in a different location than it exists on the host. The problem
     # isn't quite clear, but anyhow it shouldn't be necessary to filter untracked files in
     # submodules here.
-    git_status_output = check_output(["git", "status", "-s", "--ignored"], cwd=toplevel_dir)
+    git_status_output = subprocess.check_output(["git", "status", "-s", "--ignored"], cwd=toplevel_dir)
     untracked = [
         line[3:]
         for line in git_status_output.split("\n")
diff --git a/tests/lint/flake8.sh b/tests/lint/flake8.sh
index 63dad38166..36b891fc78 100755
--- a/tests/lint/flake8.sh
+++ b/tests/lint/flake8.sh
@@ -18,4 +18,4 @@
 
 set -e
 
-python3 -m flake8 . --count --select=E9,F63,F7 --show-source --statistics
+"${TVM_VENV}/bin/python3" -m flake8 . --count --select=E9,F63,F7 --show-source --statistics
diff --git a/tests/lint/jnilint.sh b/tests/lint/jnilint.sh
index ec359a5b89..2768bed875 100755
--- a/tests/lint/jnilint.sh
+++ b/tests/lint/jnilint.sh
@@ -18,4 +18,4 @@
 
 set -e
 
-python3 3rdparty/dmlc-core/scripts/lint.py tvm4j-jni cpp jvm/native/src
+"${TVM_VENV}/bin/python3" 3rdparty/dmlc-core/scripts/lint.py tvm4j-jni cpp jvm/native/src
diff --git a/tests/lint/pylint.sh b/tests/lint/pylint.sh
index 6c958a9231..bb2dff95ce 100755
--- a/tests/lint/pylint.sh
+++ b/tests/lint/pylint.sh
@@ -17,6 +17,7 @@
 # under the License.
 set -euxo pipefail
 
-python3 -m pylint python/tvm --rcfile="$(dirname "$0")"/pylintrc
-python3 -m pylint vta/python/vta --rcfile="$(dirname "$0")"/pylintrc
-python3 -m pylint tests/python/unittest/test_tvmscript_type.py --rcfile="$(dirname "$0")"/pylintrc
+"${TVM_VENV}/bin/python3" -m pylint python/tvm --rcfile="$(dirname "$0")"/pylintrc
+"${TVM_VENV}/bin/python3" -m pylint vta/python/vta --rcfile="$(dirname "$0")"/pylintrc
+"${TVM_VENV}/bin/python3" -m pylint tests/python/unittest/test_tvmscript_type.py \
+                          --rcfile="$(dirname "$0")"/pylintrc