Skip to content

Commit a8d9cd6

Browse files
author
Steven Silvester
committed
more cleanup
1 parent d091df6 commit a8d9cd6

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

jupyter_releaser/changelog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def get_version_entry(
8080

8181
if not since:
8282
tags = util.run(
83-
f"git --no-pager tag --sort=-creatordate --merged {remote}/{branch}"
83+
f"git --no-pager tag --sort=-creatordate --merged {remote}/{branch}",
84+
quiet=True,
8485
)
8586
if tags:
8687
since = tags.splitlines()[0]

jupyter_releaser/lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def publish_assets(dist_dir, npm_token, npm_cmd, twine_cmd, dry_run):
372372
name = Path(path).name
373373
suffix = Path(path).suffix
374374
if suffix in [".gz", ".whl"]:
375-
util.run(f"{twine_cmd} {name}", cwd=dist_dir)
375+
util.retry(f"{twine_cmd} {name}", cwd=dist_dir)
376376
found = True
377377
elif suffix == ".tgz":
378378
# Ignore already published versions

jupyter_releaser/npm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ def check_dist(dist_dir, install_options):
101101
tmp_dir = Path(TemporaryDirectory().name)
102102
os.makedirs(tmp_dir)
103103

104-
util.run("npm init -y", cwd=tmp_dir)
104+
util.run("npm init -y", cwd=tmp_dir, quiet=True)
105105
names = []
106106
staging = tmp_dir / "staging"
107107

108108
names = extract_dist(dist_dir, staging)
109109

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

112-
util.run(f"npm install {install_options} {install_str}", cwd=tmp_dir)
112+
util.run(f"npm install {install_options} {install_str}", cwd=tmp_dir, quiet=True)
113113

114114
shutil.rmtree(str(tmp_dir), ignore_errors=True)
115115

jupyter_releaser/util.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import shlex
1111
import shutil
1212
import sys
13+
import time
1314
from glob import glob
1415
from pathlib import Path
1516
from subprocess import CalledProcessError
@@ -252,6 +253,18 @@ def get_latest_tag(branch):
252253
return tags.splitlines()[0]
253254

254255

256+
def retry(cmd, **kwargs):
257+
"""Run a command with retries"""
258+
attempt = 0
259+
while attempt < 3:
260+
time.sleep(attempt)
261+
try:
262+
run(cmd, **kwargs)
263+
return
264+
except Exception:
265+
attempt += 1
266+
267+
255268
def read_config():
256269
"""Read the jupyter-releaser config data"""
257270
if JUPYTER_RELEASER_CONFIG.exists():

0 commit comments

Comments
 (0)