Fix `pyright` complaints and run `black` (#12)
This commit is contained in:
parent
2e4bd593e5
commit
bf77cea86d
|
@ -0,0 +1,4 @@
|
||||||
|
[flake8]
|
||||||
|
# E203: whitespace before ':'
|
||||||
|
# E501: line too long
|
||||||
|
extend-ignore = E203,E501
|
|
@ -21,10 +21,9 @@ use Python.
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import textwrap
|
import textwrap
|
||||||
from typing import Optional, Union, Tuple, Match, Dict, List
|
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Dict, List, Match, Optional, Tuple, Union
|
||||||
|
|
||||||
NinjaPath = Union[str, Path]
|
NinjaPath = Union[str, Path]
|
||||||
NinjaPaths = Union[
|
NinjaPaths = Union[
|
||||||
|
@ -125,17 +124,17 @@ class Writer(object):
|
||||||
if implicit:
|
if implicit:
|
||||||
implicit = [escape_path(x) for x in serialize_paths(implicit)]
|
implicit = [escape_path(x) for x in serialize_paths(implicit)]
|
||||||
all_inputs.append("|")
|
all_inputs.append("|")
|
||||||
all_inputs.extend(implicit)
|
all_inputs.extend(map(str, implicit))
|
||||||
if order_only:
|
if order_only:
|
||||||
order_only = [escape_path(x) for x in serialize_paths(order_only)]
|
order_only = [escape_path(x) for x in serialize_paths(order_only)]
|
||||||
all_inputs.append("||")
|
all_inputs.append("||")
|
||||||
all_inputs.extend(order_only)
|
all_inputs.extend(map(str, order_only))
|
||||||
if implicit_outputs:
|
if implicit_outputs:
|
||||||
implicit_outputs = [
|
implicit_outputs = [
|
||||||
escape_path(x) for x in serialize_paths(implicit_outputs)
|
escape_path(x) for x in serialize_paths(implicit_outputs)
|
||||||
]
|
]
|
||||||
out_outputs.append("|")
|
out_outputs.append("|")
|
||||||
out_outputs.extend(implicit_outputs)
|
out_outputs.extend(map(str, implicit_outputs))
|
||||||
|
|
||||||
self._line(
|
self._line(
|
||||||
"build %s: %s" % (" ".join(out_outputs), " ".join([rule] + all_inputs))
|
"build %s: %s" % (" ".join(out_outputs), " ".join([rule] + all_inputs))
|
||||||
|
|
|
@ -12,13 +12,13 @@
|
||||||
|
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
|
import math
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
import math
|
|
||||||
|
|
||||||
from typing import Optional, Union, Tuple, Dict, List, Set, Any
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Any, Dict, List, Optional, Set, Tuple, Union
|
||||||
|
|
||||||
from . import ninja_syntax
|
from . import ninja_syntax
|
||||||
|
|
||||||
if sys.platform == "cygwin":
|
if sys.platform == "cygwin":
|
||||||
|
@ -204,6 +204,7 @@ def generate_build_ninja(
|
||||||
n.comment("Tooling")
|
n.comment("Tooling")
|
||||||
|
|
||||||
build_path = config.out_path()
|
build_path = config.out_path()
|
||||||
|
progress_path = build_path / "progress.json"
|
||||||
build_tools_path = config.build_dir / "tools"
|
build_tools_path = config.build_dir / "tools"
|
||||||
download_tool = config.tools_dir / "download_tool.py"
|
download_tool = config.tools_dir / "download_tool.py"
|
||||||
n.rule(
|
n.rule(
|
||||||
|
@ -417,8 +418,8 @@ def generate_build_ninja(
|
||||||
self.entry = config["entry"]
|
self.entry = config["entry"]
|
||||||
self.inputs: List[str] = []
|
self.inputs: List[str] = []
|
||||||
|
|
||||||
def add(self, obj: str) -> None:
|
def add(self, obj: os.PathLike) -> None:
|
||||||
self.inputs.append(obj)
|
self.inputs.append(str(obj))
|
||||||
|
|
||||||
def output(self) -> Path:
|
def output(self) -> Path:
|
||||||
if self.module_id == 0:
|
if self.module_id == 0:
|
||||||
|
@ -460,7 +461,7 @@ def generate_build_ninja(
|
||||||
else:
|
else:
|
||||||
preplf_path = build_path / self.name / f"{self.name}.preplf"
|
preplf_path = build_path / self.name / f"{self.name}.preplf"
|
||||||
plf_path = build_path / self.name / f"{self.name}.plf"
|
plf_path = build_path / self.name / f"{self.name}.plf"
|
||||||
preplf_ldflags = f"$ldflags -sdata 0 -sdata2 0 -r"
|
preplf_ldflags = "$ldflags -sdata 0 -sdata2 0 -r"
|
||||||
plf_ldflags = f"$ldflags -sdata 0 -sdata2 0 -r1 -lcf {self.ldscript}"
|
plf_ldflags = f"$ldflags -sdata 0 -sdata2 0 -r1 -lcf {self.ldscript}"
|
||||||
if self.entry:
|
if self.entry:
|
||||||
plf_ldflags += f" -m {self.entry}"
|
plf_ldflags += f" -m {self.entry}"
|
||||||
|
@ -646,7 +647,7 @@ def generate_build_ninja(
|
||||||
rels_to_generate = list(
|
rels_to_generate = list(
|
||||||
filter(
|
filter(
|
||||||
lambda step: step.module_id != 0
|
lambda step: step.module_id != 0
|
||||||
and not step.name in generated_rels,
|
and step.name not in generated_rels,
|
||||||
link_steps_local,
|
link_steps_local,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -714,7 +715,6 @@ def generate_build_ninja(
|
||||||
# Calculate progress
|
# Calculate progress
|
||||||
###
|
###
|
||||||
n.comment("Calculate progress")
|
n.comment("Calculate progress")
|
||||||
progress_path = build_path / "progress.json"
|
|
||||||
n.rule(
|
n.rule(
|
||||||
name="progress",
|
name="progress",
|
||||||
command=f"$python {configure_script} $configure_args progress",
|
command=f"$python {configure_script} $configure_args progress",
|
||||||
|
|
Loading…
Reference in New Issue