Skip to content
Closed
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
61 changes: 21 additions & 40 deletions abxpkg/binprovider_pnpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,6 @@ def default_install_handler(
) -> str:
installer_bin = self.INSTALLER_BINARY(no_cache=no_cache).loaded_abspath
assert installer_bin
postinstall_scripts = (
False if postinstall_scripts is None else postinstall_scripts
)
min_release_age = 7.0 if min_release_age is None else min_release_age
install_args = install_args or self.get_install_args(bin_name)
if min_version:
install_args = [
Expand All @@ -351,29 +347,23 @@ def default_install_handler(
else arg
for arg in install_args
]
if any(
arg == "--ignore-scripts" for arg in ("--loglevel=error", *install_args)
):
if postinstall_scripts is None:
postinstall_scripts = False
if any(arg == "--ignore-scripts" for arg in install_args):
postinstall_scripts = False
if min_release_age is None:
min_release_age = 7.0

cmd: list[str] = [
"add",
"--loglevel=error",
f"--store-dir={self.cache_dir}",
]
cmd: list[str] = ["add", "--loglevel=error", f"--store-dir={self.cache_dir}"]
if not postinstall_scripts:
cmd.append("--ignore-scripts")
else:
# pnpm 10+ blocks ALL postinstall scripts unless explicitly allowed.
cmd.append("--config.dangerouslyAllowAllBuilds=true")
if (
min_release_age is not None
and min_release_age > 0
and not any(
arg == "--config.minimumReleaseAge"
or arg.startswith("--config.minimumReleaseAge=")
for arg in ("--loglevel=error", *install_args)
)
if min_release_age > 0 and not any(
arg == "--config.minimumReleaseAge"
or arg.startswith("--config.minimumReleaseAge=")
for arg in install_args
):
cmd.append(
f"--config.minimumReleaseAge={max(int(min_release_age * 24 * 60), 1)}",
Expand All @@ -399,10 +389,6 @@ def default_update_handler(
) -> str:
installer_bin = self.INSTALLER_BINARY(no_cache=no_cache).loaded_abspath
assert installer_bin
postinstall_scripts = (
False if postinstall_scripts is None else postinstall_scripts
)
min_release_age = 7.0 if min_release_age is None else min_release_age
install_args = install_args or self.get_install_args(bin_name)
if min_version:
install_args = [
Expand All @@ -414,28 +400,23 @@ def default_update_handler(
else arg
for arg in install_args
]
if any(
arg == "--ignore-scripts" for arg in ("--loglevel=error", *install_args)
):
if postinstall_scripts is None:
postinstall_scripts = False
if any(arg == "--ignore-scripts" for arg in install_args):
postinstall_scripts = False
if min_release_age is None:
min_release_age = 7.0

cmd: list[str] = [
"add" if min_version is not None else "update",
"--loglevel=error",
f"--store-dir={self.cache_dir}",
]
verb = "add" if min_version is not None else "update"
cmd: list[str] = [verb, "--loglevel=error", f"--store-dir={self.cache_dir}"]
if not postinstall_scripts:
cmd.append("--ignore-scripts")
else:
cmd.append("--config.dangerouslyAllowAllBuilds=true")
if (
min_release_age is not None
and min_release_age > 0
and not any(
arg == "--config.minimumReleaseAge"
or arg.startswith("--config.minimumReleaseAge=")
for arg in ("--loglevel=error", *install_args)
)
if min_release_age > 0 and not any(
arg == "--config.minimumReleaseAge"
or arg.startswith("--config.minimumReleaseAge=")
for arg in install_args
):
cmd.append(
f"--config.minimumReleaseAge={max(int(min_release_age * 24 * 60), 1)}",
Expand Down
Loading