From caac4b9bd7fb47fdc173995abd7b14f1d9759d32 Mon Sep 17 00:00:00 2001 From: Greg Magolan Date: Sat, 6 Apr 2024 09:53:34 -0700 Subject: [PATCH] refactor: remove utils.home_directory and use get_home_directory from Aspect bazel-lib utils instead (#1606) --- npm/extensions.bzl | 2 +- npm/private/npm_translate_lock_state.bzl | 2 +- npm/private/utils.bzl | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/npm/extensions.bzl b/npm/extensions.bzl index 060b97d78b..800ebbd0a1 100644 --- a/npm/extensions.bzl +++ b/npm/extensions.bzl @@ -119,7 +119,7 @@ def _npm_lock_imports_bzlmod(module_ctx, attr): (registries, npm_auth) = npm_translate_lock_helpers.get_npm_auth(npmrc, module_ctx.path(attr.npmrc), module_ctx.os.environ) if attr.use_home_npmrc: - home_directory = utils.home_directory(module_ctx) + home_directory = repo_utils.home_directory(module_ctx) if home_directory: home_npmrc_path = "{}/{}".format(home_directory, ".npmrc") home_npmrc = parse_npmrc(module_ctx.read(home_npmrc_path)) diff --git a/npm/private/npm_translate_lock_state.bzl b/npm/private/npm_translate_lock_state.bzl index c759ca4e78..1965ddaded 100644 --- a/npm/private/npm_translate_lock_state.bzl +++ b/npm/private/npm_translate_lock_state.bzl @@ -483,7 +483,7 @@ def _load_npmrc(priv, rctx, npmrc_path): ################################################################################ def _load_home_npmrc(priv, rctx): - home_directory = utils.home_directory(rctx) + home_directory = repo_utils.get_home_directory(rctx) if not home_directory: # buildifier: disable=print print(""" diff --git a/npm/private/utils.bzl b/npm/private/utils.bzl index 10fada3f8c..a6c17b8c3c 100644 --- a/npm/private/utils.bzl +++ b/npm/private/utils.bzl @@ -372,9 +372,6 @@ if [ ! -f $1 ]; then exit 42; fi else: fail(INTERNAL_ERROR_MSG) -def _home_directory(rctx): - return repo_utils.get_env_var(rctx, "HOME", None) - def _replace_npmrc_token_envvar(token, npmrc_path, environ): # A token can be a reference to an environment variable if token.startswith("$"): @@ -457,7 +454,6 @@ utils = struct( dicts_match = _dicts_match, reverse_force_copy = _reverse_force_copy, exists = _exists, - home_directory = _home_directory, replace_npmrc_token_envvar = _replace_npmrc_token_envvar, is_vendored_tarfile = _is_vendored_tarfile, is_tarball_extension = _is_tarball_extension,