From 3b5e8e5041a7e137720a763f82a215988d35bf21 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Tue, 18 May 2021 22:19:09 +0200 Subject: [PATCH] Fix black workaround for format calls --- pylib/tests/run_format.py | 2 +- pylib/tools/hookslib.py | 2 +- qt/tests/run_format.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pylib/tests/run_format.py b/pylib/tests/run_format.py index 82edff2a2..80751c7a8 100644 --- a/pylib/tests/run_format.py +++ b/pylib/tests/run_format.py @@ -20,7 +20,7 @@ if __name__ == "__main__": args = ["--diff", "--check"] # work around issue with latest black - if sys.platform == "win32": + if sys.platform == "win32" and "HOME" in os.environ: os.environ["USERPROFILE"] = os.environ["HOME"] retcode = subprocess.run( diff --git a/pylib/tools/hookslib.py b/pylib/tools/hookslib.py index defd28305..ab499c896 100644 --- a/pylib/tools/hookslib.py +++ b/pylib/tools/hookslib.py @@ -162,7 +162,7 @@ def write_file(path: str, hooks: List[Hook], prefix: str, suffix: str): code += "\n" + suffix # work around issue with latest black - if sys.platform == "win32": + if sys.platform == "win32" and "HOME" in os.environ: os.environ["USERPROFILE"] = os.environ["HOME"] with open(path, "wb") as file: file.write(code.encode("utf8")) diff --git a/qt/tests/run_format.py b/qt/tests/run_format.py index f0a4f5e36..6210a896b 100644 --- a/qt/tests/run_format.py +++ b/qt/tests/run_format.py @@ -19,7 +19,7 @@ if __name__ == "__main__": args = ["--diff", "--check"] # work around issue with latest black - if sys.platform == "win32": + if sys.platform == "win32" and "HOME" in os.environ: os.environ["USERPROFILE"] = os.environ["HOME"] retcode = subprocess.run(