@@ -45,13 +45,13 @@ WARNING: `update_pnpm_lock` attribute in `npm_translate_lock(name = "{rctx_name}
4545 # labels only needed when updating the pnpm lock file
4646 _init_update_labels (priv , rctx , attr , label_store )
4747
48- _init_link_workspace (priv , rctx , attr , label_store )
48+ _init_link_workspace (priv , attr , label_store )
4949
5050 # parse the pnpm lock file incase since we need the importers list for additional init
5151 # TODO(windows): utils.exists is not yet support on Windows
5252 pnpm_lock_exists = is_windows or utils .exists (rctx , label_store .path ("pnpm_lock" ))
5353 if pnpm_lock_exists :
54- _load_lockfile (priv , rctx , attr , label_store )
54+ _load_lockfile (priv , rctx , label_store )
5555 _init_patched_dependencies_labels (priv , rctx , attr , label_store )
5656
5757 # May depend on lockfile state
@@ -167,12 +167,10 @@ def _init_patches_labels(priv, _, attr, label_store):
167167################################################################################
168168def _init_patched_dependencies_labels (priv , _ , attr , label_store ):
169169 # Read patches from pnpm-lock.yaml `patchedDependencies`
170- patches = []
171- for patch_info in priv ["patched_dependencies" ].values ():
172- patches .append ("//%s:%s" % (label_store .label ("pnpm_lock" ).package , patch_info .get ("path" )))
173-
174- # Convert patch label strings to labels
175- patches = [attr .pnpm_lock .relative (p ) for p in patches ]
170+ patches = [
171+ attr .pnpm_lock .same_package_label (patch_info ["path" ])
172+ for patch_info in priv ["patched_dependencies" ].values ()
173+ ]
176174
177175 for i , d in enumerate (patches ):
178176 label_store .add ("patches_{}" .format (i + priv ["num_patches" ]), d )
@@ -185,7 +183,7 @@ def _init_importer_labels(priv, label_store):
185183 label_store .add_sibling ("lock" , "package_json_{}" .format (i ), paths .join (p , PACKAGE_JSON_FILENAME ))
186184
187185################################################################################
188- def _init_link_workspace (priv , _ , attr , label_store ):
186+ def _init_link_workspace (priv , attr , label_store ):
189187 # initialize link_workspace either from pnpm_lock label or from override
190188 priv ["link_workspace" ] = attr .link_workspace if attr .link_workspace else label_store .label ("pnpm_lock" ).repo_name
191189
@@ -283,7 +281,7 @@ def _copy_update_input_files(priv, rctx, attr, label_store):
283281################################################################################
284282# we can derive input files that should be specified but are not and copy these over; we warn the user when we do this
285283def _copy_unspecified_input_files (priv , rctx , attr , label_store ):
286- pnpm_lock_label = label_store . label ( " pnpm_lock" )
284+ pnpm_lock_label = attr . pnpm_lock
287285
288286 # pnpm-workspace.yaml
289287 pnpm_workspace_key = "pnpm_workspace"
@@ -479,7 +477,7 @@ WARNING: Cannot determine home directory in order to load home `.npmrc` file in
479477 _load_npmrc (priv , rctx , home_npmrc_path )
480478
481479################################################################################
482- def _load_lockfile (priv , rctx , _ , label_store ):
480+ def _load_lockfile (priv , rctx , label_store ):
483481 importers = {}
484482 packages = {}
485483 patched_dependencies = {}
0 commit comments