Skip to content

Commit b18bc5f

Browse files
committed
More fixups
1 parent 5acf2a4 commit b18bc5f

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

jupyter_releaser/cli.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ def main():
194194
]
195195
)
196196

197+
npm_install_options = [
198+
click.option(
199+
"--npm-install-options",
200+
envvar="RH_NPM_INSTALL_OPTIONS",
201+
default="",
202+
help="Options to pass when calling npm install",
203+
)
204+
]
205+
197206

198207
def add_options(options):
199208
"""Add extracted common options to a click command"""
@@ -319,13 +328,14 @@ def build_npm(package, dist_dir):
319328

320329
@main.command()
321330
@add_options(dist_dir_options)
331+
@add_options(npm_install_options)
322332
@use_checkout_dir()
323-
def check_npm(dist_dir):
333+
def check_npm(dist_dir, npm_install_options):
324334
"""Check npm package"""
325335
if not osp.exists("./package.json"):
326336
util.log("Skipping check-npm since there is no package.json file")
327337
return
328-
npm.check_dist(dist_dir)
338+
npm.check_dist(dist_dir, npm_install_options)
329339

330340

331341
@main.command()
@@ -434,10 +444,11 @@ def delete_release(auth, release_url):
434444
@add_options(auth_options)
435445
@add_options(dist_dir_options)
436446
@add_options(dry_run_options)
447+
@add_options(npm_install_options)
437448
@click.argument("release-url", nargs=1)
438-
def extract_release(auth, dist_dir, dry_run, release_url):
449+
def extract_release(auth, dist_dir, dry_run, release_url, npm_install_options):
439450
"""Download and verify assets from a draft GitHub release"""
440-
lib.extract_release(auth, dist_dir, dry_run, release_url)
451+
lib.extract_release(auth, dist_dir, dry_run, release_url, npm_install_options)
441452

442453

443454
@main.command()

jupyter_releaser/lib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def delete_release(auth, release_url):
256256
gh.repos.delete_release(release.id)
257257

258258

259-
def extract_release(auth, dist_dir, dry_run, release_url):
259+
def extract_release(auth, dist_dir, dry_run, release_url, npm_install_options):
260260
"""Download and verify assets from a draft GitHub release"""
261261
match = parse_release_url(release_url)
262262
owner, repo = match["owner"], match["repo"]
@@ -285,7 +285,7 @@ def extract_release(auth, dist_dir, dry_run, release_url):
285285
if suffix in [".gz", ".whl"]:
286286
python.check_dist(path)
287287
elif suffix == ".tgz":
288-
npm.check_dist(path)
288+
npm.check_dist(path, npm_install_options)
289289
else:
290290
util.log(f"Nothing to check for {asset.name}")
291291

@@ -484,9 +484,9 @@ def prep_git(ref, branch, repo, auth, username, url, install=True):
484484

485485
# Install the package
486486
if install:
487-
# install python package with test deps
487+
# install python package in editable mode with test deps
488488
if util.SETUP_PY.exists():
489-
util.run('pip install ".[test]"')
489+
util.run('pip install -e ".[test]"')
490490

491491
# prefer yarn if yarn lock exists
492492
elif util.YARN_LOCK.exists():

jupyter_releaser/npm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def extract_dist(dist_dir, target):
100100
return names
101101

102102

103-
def check_dist(dist_dir):
103+
def check_dist(dist_dir, install_options):
104104
"""Check npm dist file(s) in a dist dir"""
105105
tmp_dir = Path(TemporaryDirectory().name)
106106
os.makedirs(tmp_dir)
@@ -113,7 +113,7 @@ def check_dist(dist_dir):
113113

114114
install_str = " ".join(f"./staging/{name}" for name in names)
115115

116-
util.run(f"npm install {install_str}", cwd=tmp_dir)
116+
util.run(f"npm install {install_options} {install_str}", cwd=tmp_dir)
117117

118118
shutil.rmtree(str(tmp_dir), ignore_errors=True)
119119

jupyter_releaser/tests/test_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def test_list_envvars(runner):
123123
dry-run: RH_DRY_RUN
124124
links-expire: RH_LINKS_EXPIRE
125125
npm-cmd: RH_NPM_COMMAND
126+
npm-install-options: RH_NPM_INSTALL_OPTIONS
126127
npm-token: NPM_TOKEN
127128
output: RH_CHANGELOG_OUTPUT
128129
post-version-spec: RH_POST_VERSION_SPEC

0 commit comments

Comments
 (0)