diff --git a/pylib/tests/run_format.py b/pylib/tests/run_format.py index f69ad6b46..fa9658c17 100644 --- a/pylib/tests/run_format.py +++ b/pylib/tests/run_format.py @@ -1,6 +1,7 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +import fcntl import os import subprocess import sys @@ -10,6 +11,10 @@ if __name__ == "__main__": isort_ini = os.path.abspath(isort_ini) fix = len(sys.argv) > 2 + if sys.platform == "linux": + file = open("/tmp/anki-black", "w") + fcntl.lockf(file, fcntl.LOCK_EX) + if fix: os.chdir(os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "pylib")) args = [] diff --git a/qt/tests/run_format.py b/qt/tests/run_format.py index 092e3d1b0..a4a34d048 100644 --- a/qt/tests/run_format.py +++ b/qt/tests/run_format.py @@ -1,6 +1,7 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +import fcntl import os import subprocess import sys @@ -10,6 +11,10 @@ if __name__ == "__main__": isort_ini = os.path.abspath(isort_ini) fix = len(sys.argv) > 2 + if sys.platform == "linux": + file = open("/tmp/anki-black", "w") + fcntl.lockf(file, fcntl.LOCK_EX) + if fix: os.chdir(os.path.join(os.environ["BUILD_WORKSPACE_DIRECTORY"], "qt")) args = []