Skip to content

Commit 3940adc

Browse files
committed
Serialize pnpm bootstrap discovery and install
1 parent 454cf37 commit 3940adc

2 files changed

Lines changed: 49 additions & 15 deletions

File tree

abxpkg/binprovider_pnpm.py

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -436,21 +436,55 @@ def INSTALLER_BINARY(self, no_cache: bool = False):
436436
if loaded is not None:
437437
return loaded
438438

439-
local_installer = (
440-
self._installer_provider_root()
441-
/ "node_modules"
442-
/ ".bin"
443-
/ str(
444-
self.INSTALLER_BIN,
445-
)
446-
)
447-
if local_installer.is_file() and os.access(local_installer, os.X_OK):
448-
loaded = self._load_installer_at(local_installer, no_cache=no_cache)
449-
if loaded is not None:
450-
return loaded
439+
from .binprovider_npm import NpmProvider
451440

452-
loaded = self._install_installer_binary(no_cache=no_cache)
453-
return loaded
441+
installer_root = self._installer_provider_root()
442+
node_loaded = self._cache_node_dependency(no_cache=no_cache)
443+
pnpm_package = self._pnpm_package_for_node(
444+
node_loaded.loaded_version if node_loaded is not None else None,
445+
)
446+
installer_provider = NpmProvider(
447+
install_root=installer_root,
448+
postinstall_scripts=True,
449+
min_release_age=0,
450+
).get_provider_with_overrides(
451+
overrides={"pnpm": {"install_args": [pnpm_package]}},
452+
)
453+
with installer_provider.mutation_lock():
454+
local_installer = (
455+
installer_root
456+
/ "node_modules"
457+
/ ".bin"
458+
/ str(
459+
self.INSTALLER_BIN,
460+
)
461+
)
462+
if local_installer.is_file() and os.access(local_installer, os.X_OK):
463+
loaded = installer_provider.load(
464+
self.INSTALLER_BIN,
465+
quiet=True,
466+
no_cache=True,
467+
)
468+
if loaded and loaded.loaded_abspath:
469+
if loaded.loaded_version and loaded.loaded_sha256:
470+
self.write_cached_binary(
471+
self.INSTALLER_BIN,
472+
loaded.loaded_abspath,
473+
loaded.loaded_version,
474+
loaded.loaded_sha256,
475+
resolved_provider_name=(
476+
loaded.loaded_binprovider.name
477+
if loaded.loaded_binprovider is not None
478+
else self.name
479+
),
480+
resolved_provider=loaded.loaded_binprovider,
481+
cache_kind="dependency",
482+
)
483+
self._INSTALLER_BINARY = loaded
484+
self._cache_node_dependency(no_cache=no_cache)
485+
return loaded
486+
487+
return self._install_installer_binary(no_cache=no_cache)
454488

455489
@log_method_call(include_result=True)
456490
def exec(

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "abxpkg"
3-
version = "1.11.285"
3+
version = "1.11.286"
44
description = "System package manager interfaces with Python type hints"
55
authors = [{name = "Nick Sweeting"}, {name = "ArchiveBox"}]
66
requires-python = ">=3.12,<3.15"

0 commit comments

Comments
 (0)