Linter when only python3 exists

Reviewed By: nikhilaravi

Differential Revision: D31289856

fbshipit-source-id: 5a522a69537a873bacacf2a178e5f30771aef35f
This commit is contained in:
Jeremy Reizenstein 2021-09-30 00:54:19 -07:00 committed by Facebook GitHub Bot
parent dd76b41014
commit 1aab192706

View File

@ -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