Skip to content

Commit

Permalink
Merge pull request #107 from blink1073/more-quiet-fixes
Browse files Browse the repository at this point in the history
More Cleanup
  • Loading branch information
Steven Silvester authored Aug 17, 2021
2 parents d091df6 + a8d9cd6 commit d515b1d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 2 additions & 1 deletion jupyter_releaser/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def get_version_entry(

if not since:
tags = util.run(
f"git --no-pager tag --sort=-creatordate --merged {remote}/{branch}"
f"git --no-pager tag --sort=-creatordate --merged {remote}/{branch}",
quiet=True,
)
if tags:
since = tags.splitlines()[0]
Expand Down
2 changes: 1 addition & 1 deletion jupyter_releaser/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def publish_assets(dist_dir, npm_token, npm_cmd, twine_cmd, dry_run):
name = Path(path).name
suffix = Path(path).suffix
if suffix in [".gz", ".whl"]:
util.run(f"{twine_cmd} {name}", cwd=dist_dir)
util.retry(f"{twine_cmd} {name}", cwd=dist_dir)
found = True
elif suffix == ".tgz":
# Ignore already published versions
Expand Down
4 changes: 2 additions & 2 deletions jupyter_releaser/npm.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ def check_dist(dist_dir, install_options):
tmp_dir = Path(TemporaryDirectory().name)
os.makedirs(tmp_dir)

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

names = extract_dist(dist_dir, staging)

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

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

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

Expand Down
13 changes: 13 additions & 0 deletions jupyter_releaser/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import shlex
import shutil
import sys
import time
from glob import glob
from pathlib import Path
from subprocess import CalledProcessError
Expand Down Expand Up @@ -252,6 +253,18 @@ def get_latest_tag(branch):
return tags.splitlines()[0]


def retry(cmd, **kwargs):
"""Run a command with retries"""
attempt = 0
while attempt < 3:
time.sleep(attempt)
try:
run(cmd, **kwargs)
return
except Exception:
attempt += 1


def read_config():
"""Read the jupyter-releaser config data"""
if JUPYTER_RELEASER_CONFIG.exists():
Expand Down

0 comments on commit d515b1d

Please sign in to comment.