diff --git a/pip/.isort.cfg b/pip/.isort.cfg deleted file mode 100644 index 903ecee1f..000000000 --- a/pip/.isort.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[settings] -skip_gitignore=True -profile=black -multi_line_output=3 -include_trailing_comma=True -force_grid_wrap=0 -use_parentheses=True -line_length=88 -ensure_newline_before_comments=true -known_first_party=aqt,anki,tests diff --git a/scripts/BUILD.bazel b/scripts/BUILD.bazel index 789ecf996..bfd938208 100644 --- a/scripts/BUILD.bazel +++ b/scripts/BUILD.bazel @@ -7,9 +7,3 @@ py_binary( stamp = 1, visibility = ["//visibility:public"], ) - -py_binary( - name = "format", - srcs = ["format.py"], - tags = ["manual"], -) diff --git a/scripts/format.py b/scripts/format.py deleted file mode 100755 index 104bdf9c1..000000000 --- a/scripts/format.py +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright: Ankitects Pty Ltd and contributors -# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - -""" -This is an experiment with running some of the formatters outside -of Bazel' testing system. It means we pick up files not explictly -listed as inputs, but also means that work is done even when files -have not changed, and it does not work on Windows. -""" - -import os -import subprocess -import sys -import time -from pathlib import Path - -workspace = Path(os.environ["BUILD_WORKSPACE_DIRECTORY"]) -binroot = workspace / "bazel-bin" -pyroot = binroot / "pip" -tsroot = workspace / "ts" -tsbinroot = tsroot / "node_modules" / ".bin" - -if sys.platform.startswith("win32"): - binext = ".exe" -else: - binext = "" - -# pyargs = ["--check"] -# prettierargs = "--check" -pyargs = [] -prettierargs = "--write" - - -def taken(stamp): - ms = int((time.time() - stamp) * 1000.0) - return f"{ms}ms" - - -failed = False - -print("* Fixing Python formatting...", end="", flush=True) -t = time.time() -if subprocess.run( - [ - str(pyroot / ("black" + binext)), - ] - + pyargs - + [ - "-t", - "py38", - "--exclude='qt/aqt/forms|_gen|bazel-|node_modules'", - "-q", - ".", - ], - cwd=workspace, -).returncode: - failed = True -print(taken(t)) - -print("* Fixing Python imports...", end="", flush=True) -t = time.time() -if subprocess.run( - [ - str(pyroot / ("isort" + binext)), - ] - + pyargs - + [ - "--settings-path", - "pip/.isort.cfg", - "--skip", - "forms", - "--sg", - "*_gen.py", - "--skip", - "generated.py", - "-q", - ".", - ], - cwd=workspace, -).returncode: - failed = True -print(taken(t)) - -print("* Fixing Typescript formatting...", end="\n", flush=True) -t = time.time() -if subprocess.run( - [ - tsbinroot / ("prettier" + binext), - "--config", - tsroot / ".prettierrc", - "--ignore-path", - tsroot / ".prettierignore", - "--loglevel", - "silent", - prettierargs, - "ts", - "qt", - ], - cwd=workspace, -).returncode: - failed = True -print(taken(t)) - -print("* Fixing Fluent formatting...", end="", flush=True) -t = time.time() -if subprocess.run( - [ - binroot / "ftl" / ("format" + binext), - ], - cwd=workspace, -).returncode: - failed = True -print(taken(t)) - - -if failed: - sys.exit(1)