diff --git a/abxpkg/binprovider_pnpm.py b/abxpkg/binprovider_pnpm.py index 151a26ad..0b0fed43 100755 --- a/abxpkg/binprovider_pnpm.py +++ b/abxpkg/binprovider_pnpm.py @@ -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 = [ @@ -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)}", @@ -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 = [ @@ -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)}",