mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
parent
99081e422b
commit
c41d5ca4bf
4 changed files with 13 additions and 2 deletions
|
@ -12,7 +12,7 @@ attrs==21.1.0
|
||||||
# pytest
|
# pytest
|
||||||
beautifulsoup4==4.9.3
|
beautifulsoup4==4.9.3
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
black==20.8b1
|
black==21.5b0
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
certifi==2020.12.5
|
certifi==2020.12.5
|
||||||
# via requests
|
# via requests
|
||||||
|
|
|
@ -19,6 +19,10 @@ if __name__ == "__main__":
|
||||||
os.chdir(folder)
|
os.chdir(folder)
|
||||||
args = ["--diff", "--check"]
|
args = ["--diff", "--check"]
|
||||||
|
|
||||||
|
# work around issue with latest black
|
||||||
|
if sys.platform == "win32":
|
||||||
|
os.environ["USERPROFILE"] = os.environ["HOME"]
|
||||||
|
|
||||||
retcode = subprocess.run(
|
retcode = subprocess.run(
|
||||||
[
|
[
|
||||||
sys.executable,
|
sys.executable,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
Code for generating hooks.
|
Code for generating hooks.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
@ -161,6 +161,9 @@ def write_file(path: str, hooks: List[Hook], prefix: str, suffix: str):
|
||||||
|
|
||||||
code += "\n" + suffix
|
code += "\n" + suffix
|
||||||
|
|
||||||
|
# work around issue with latest black
|
||||||
|
if sys.platform == "win32":
|
||||||
|
os.environ["USERPROFILE"] = os.environ["HOME"]
|
||||||
with open(path, "wb") as file:
|
with open(path, "wb") as file:
|
||||||
file.write(code.encode("utf8"))
|
file.write(code.encode("utf8"))
|
||||||
subprocess.run([sys.executable, "-m", "black", "-q", path], check=True)
|
subprocess.run([sys.executable, "-m", "black", "-q", path], check=True)
|
||||||
|
|
|
@ -18,6 +18,10 @@ if __name__ == "__main__":
|
||||||
os.chdir(folder)
|
os.chdir(folder)
|
||||||
args = ["--diff", "--check"]
|
args = ["--diff", "--check"]
|
||||||
|
|
||||||
|
# work around issue with latest black
|
||||||
|
if sys.platform == "win32":
|
||||||
|
os.environ["USERPROFILE"] = os.environ["HOME"]
|
||||||
|
|
||||||
retcode = subprocess.run(
|
retcode = subprocess.run(
|
||||||
[
|
[
|
||||||
sys.executable,
|
sys.executable,
|
||||||
|
|
Loading…
Reference in a new issue