From 1aab1927066de7897d7a12f646eaeaa228fd856b Mon Sep 17 00:00:00 2001 From: Jeremy Reizenstein Date: Thu, 30 Sep 2021 00:54:19 -0700 Subject: [PATCH] Linter when only python3 exists Reviewed By: nikhilaravi Differential Revision: D31289856 fbshipit-source-id: 5a522a69537a873bacacf2a178e5f30771aef35f --- dev/linter.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dev/linter.sh b/dev/linter.sh index 47779095..2ad74fa9 100755 --- a/dev/linter.sh +++ b/dev/linter.sh @@ -10,7 +10,10 @@ { V=$(black --version|cut '-d ' -f3) code='import distutils.version; assert "19.3" < distutils.version.LooseVersion("'$V'")' - python -c "${code}" 2> /dev/null + PYTHON=false + command -v python > /dev/null && PYTHON=python + command -v python3 > /dev/null && PYTHON=python3 + ${PYTHON} -c "${code}" 2> /dev/null } || { echo "Linter requires black 19.3b0 or higher!" exit 1