Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pylib/gyp/generator/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,9 +739,9 @@ def ComputeOutput(self, spec):
% (self.android_class, self.android_module)
)
else:
path = "$(call intermediates-dir-for,{},{},,,$(GYP_VAR_PREFIX))".format(
self.android_class,
self.android_module,
path = (
f"$(call intermediates-dir-for,{self.android_class},"
f"{self.android_module},,,$(GYP_VAR_PREFIX))"
)

assert spec.get("product_dir") is None # TODO: not supported?
Expand Down
7 changes: 3 additions & 4 deletions pylib/gyp/generator/gypsh.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ def GenerateOutput(target_list, target_dicts, data, params):
# Use a banner that looks like the stock Python one and like what
# code.interact uses by default, but tack on something to indicate what
# locals are available, and identify gypsh.
banner = "Python {} on {}\nlocals.keys() = {}\ngypsh".format(
sys.version,
sys.platform,
repr(sorted(locals.keys())),
banner = (
f"Python {sys.version} on {sys.platform}\nlocals.keys() = "
f"{sorted(locals.keys())!r}\ngypsh"
)

code.interact(banner, local=locals)
21 changes: 8 additions & 13 deletions pylib/gyp/generator/msvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1778,11 +1778,9 @@ def _GetCopies(spec):
outer_dir = posixpath.split(src_bare)[1]
fixed_dst = _FixPath(dst)
full_dst = f'"{fixed_dst}\\{outer_dir}\\"'
cmd = 'mkdir {} 2>nul & cd "{}" && xcopy /e /f /y "{}" {}'.format(
full_dst,
_FixPath(base_dir),
outer_dir,
full_dst,
cmd = (
f'mkdir {full_dst} 2>nul & cd "{_FixPath(base_dir)}" '
f'&& xcopy /e /f /y "{outer_dir}" {full_dst}'
)
copies.append(
(
Expand All @@ -1794,10 +1792,9 @@ def _GetCopies(spec):
)
else:
fix_dst = _FixPath(cpy["destination"])
cmd = 'mkdir "{}" 2>nul & set ERRORLEVEL=0 & copy /Y "{}" "{}"'.format(
fix_dst,
_FixPath(src),
_FixPath(dst),
cmd = (
f'mkdir "{fix_dst}" 2>nul & set ERRORLEVEL=0 & '
f'copy /Y "{_FixPath(src)}" "{_FixPath(dst)}"'
)
copies.append(([src], [dst], cmd, f"Copying {src} to {fix_dst}"))
return copies
Expand Down Expand Up @@ -1899,10 +1896,8 @@ def _GetPlatformOverridesOfProject(spec):
for config_name, c in spec["configurations"].items():
config_fullname = _ConfigFullName(config_name, c)
platform = c.get("msvs_target_platform", _ConfigPlatform(c))
fixed_config_fullname = "{}|{}".format(
_ConfigBaseName(config_name, _ConfigPlatform(c)),
platform,
)
base_name = _ConfigBaseName(config_name, _ConfigPlatform(c))
fixed_config_fullname = f"{base_name}|{platform}"
if spec["toolset"] == "host" and generator_supports_multiple_toolsets:
fixed_config_fullname = f"{config_name}|x64"
config_platform_overrides[config_fullname] = fixed_config_fullname
Expand Down
10 changes: 4 additions & 6 deletions pylib/gyp/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,18 +1135,16 @@ def EvalCondition(condition, conditions_key, phase, variables, build_file):
true_dict = condition[i + 1]
if type(true_dict) is not dict:
raise GypError(
"{} {} must be followed by a dictionary, not {}".format(
conditions_key, cond_expr, type(true_dict)
)
f"{conditions_key} {cond_expr} must be followed by a dictionary, "
f"not {type(true_dict)}"
)
if len(condition) > i + 2 and type(condition[i + 2]) is dict:
false_dict = condition[i + 2]
i = i + 3
if i != len(condition):
raise GypError(
"{} {} has {} unexpected trailing items".format(
conditions_key, cond_expr, len(condition) - i
)
f"{conditions_key} {cond_expr} has "
f"{len(condition) - i} unexpected trailing items"
)
else:
false_dict = None
Expand Down
10 changes: 4 additions & 6 deletions pylib/gyp/msvs_emulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,17 +830,15 @@ def _GetLdManifestFlags(
("VCLinkerTool", "UACUIAccess"), config, default="false"
)

inner = """
level = execution_level_map[execution_level]
inner = f"""
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='{}' uiAccess='{}' />
<requestedExecutionLevel level='{level}' uiAccess='{ui_access}' />
</requestedPrivileges>
</security>
</trustInfo>""".format(
execution_level_map[execution_level],
ui_access,
)
</trustInfo>"""
else:
inner = ""

Expand Down
14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ classifiers = [
]

[project.optional-dependencies]
dev = ["flake8", "ruff == 0.3.0", "pytest"]
dev = ["flake8", "ruff == 0.3.1", "pytest"]

[project.scripts]
gyp = "gyp:script_main"
Expand All @@ -38,6 +38,11 @@ gyp = "gyp:script_main"
"Homepage" = "https://github.com/nodejs/gyp-next"

[tool.ruff]
extend-exclude = ["pylib/packaging"]
line-length = 88
target-version = "py37"

[tool.ruff.lint]
select = [
"C4", # flake8-comprehensions
"C90", # McCabe cyclomatic complexity
Expand Down Expand Up @@ -101,14 +106,11 @@ ignore = [
"RUF012",
"UP031",
]
extend-exclude = ["pylib/packaging"]
line-length = 88
target-version = "py37"

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 101

[tool.ruff.pylint]
[tool.ruff.lint.pylint]
max-args = 11
max-branches = 108
max-returns = 10
Expand Down