Skip to content

Commit ee045d1

Browse files
author
Steven Silvester
authored
Merge pull request #99 from blink1073/quiet-output
Clean up build output
2 parents 6aea3e2 + c5c4b7c commit ee045d1

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

.github/actions/check-links/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ runs:
2424
# Install Jupyter Releaser from git unless we are testing Releaser itself
2525
if ! command -v jupyter-releaser &> /dev/null
2626
then
27-
pip install git+https://github.com/jupyter-server/jupyter_releaser.git
27+
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git
2828
fi
2929
3030
jupyter-releaser prep-git

.github/actions/check-release/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ runs:
3535
# Install Jupyter Releaser from git unless we are testing Releaser itself
3636
if ! command -v jupyter-releaser &> /dev/null
3737
then
38-
pip install git+https://github.com/jupyter-server/jupyter_releaser.git
38+
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git
3939
fi
4040
4141
export RH_IS_CHECK_RELEASE=true

jupyter_releaser/actions/draft_release.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
from pathlib import Path
66
from subprocess import CalledProcessError
77

8+
from jupyter_releaser.changelog import extract_current
89
from jupyter_releaser.util import CHECKOUT_NAME
910
from jupyter_releaser.util import get_latest_tag
1011
from jupyter_releaser.util import log
1112
from jupyter_releaser.util import run
1213

14+
1315
check_release = os.environ.get("RH_IS_CHECK_RELEASE", "").lower() == "true"
1416

1517
if check_release:
@@ -25,9 +27,9 @@
2527

2628
# Re-install jupyter-releaser if it was overshadowed
2729
try:
28-
run("jupyter-releaser --help")
30+
run("jupyter-releaser --help", quiet=True, quiet_error=True)
2931
except CalledProcessError:
30-
run("pip install -e .")
32+
run("pip install -q -e .")
3133

3234
run("jupyter-releaser prep-git")
3335

@@ -36,16 +38,16 @@
3638
# Do this before bumping the version
3739
curr_dir = os.getcwd()
3840
os.chdir(CHECKOUT_NAME)
39-
os.environ.setdefault("RH_SINCE", get_latest_tag(os.environ["RH_BRANCH"] or ""))
41+
os.environ.setdefault("RH_SINCE", get_latest_tag(os.environ["RH_BRANCH"]) or "")
4042
os.chdir(curr_dir)
4143

4244
run("jupyter-releaser bump-version")
4345

4446
if check_release:
4547
# Override the changelog
4648
log("Patching the changelog")
47-
log(changelog_text)
4849
Path(changelog_location).write_text(changelog_text)
50+
log(extract_current(changelog_location))
4951

5052
run("jupyter-releaser check-changelog")
5153

jupyter_releaser/lib.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def bump_version(version_spec, version_cmd):
3535

3636
# Bail if tag already exists
3737
tag_name = f"v{version}"
38-
if tag_name in util.run("git --no-pager tag").splitlines():
38+
if tag_name in util.run("git --no-pager tag", quiet=True).splitlines():
3939
msg = f"Tag {tag_name} already exists!"
4040
msg += " To delete run: `git push --delete origin {tag_name}`"
4141
raise ValueError(msg)
@@ -49,6 +49,7 @@ def check_links(ignore_glob, ignore_links, cache_file, links_expire):
4949
os.makedirs(cache_dir, exist_ok=True)
5050
cmd = "pytest --noconftest --check-links --check-links-cache "
5151
cmd += f"--check-links-cache-expire-after {links_expire} "
52+
cmd += "--disable-warnings --quiet "
5253
cmd += f"--check-links-cache-name {cache_dir}/check-release-links "
5354

5455
ignored = []
@@ -89,7 +90,7 @@ def draft_changelog(version_spec, branch, repo, since, auth, changelog_path, dry
8990
branch = branch or util.get_branch()
9091
version = util.get_version()
9192

92-
tags = util.run("git --no-pager tag")
93+
tags = util.run("git --no-pager tag", quiet=True)
9394
if f"v{version}" in tags.splitlines():
9495
raise ValueError(f"Tag v{version} already exists")
9596

@@ -470,7 +471,7 @@ def prep_git(ref, branch, repo, auth, username, url, install=True):
470471
ref = ref or ""
471472

472473
# Make sure we have *all* tags
473-
util.run("git fetch origin --tags --force")
474+
util.run("git fetch origin --tags --force --quiet")
474475

475476
# Handle the ref
476477
if ref.startswith("refs/pull/"):
@@ -500,7 +501,7 @@ def prep_git(ref, branch, repo, auth, username, url, install=True):
500501
if install:
501502
# install python package in editable mode with test deps
502503
if util.SETUP_PY.exists():
503-
util.run('pip install -e ".[test]"')
504+
util.run('pip install -q -e ".[test]"')
504505

505506
# prefer yarn if yarn lock exists
506507
elif util.YARN_LOCK.exists():
@@ -535,7 +536,7 @@ def forwardport_changelog(
535536
os.chdir(util.CHECKOUT_NAME)
536537

537538
# Bail if the tag has been merged to the branch
538-
tags = util.run(f"git --no-pager tag --merged {branch}")
539+
tags = util.run(f"git --no-pager tag --merged {branch}", quiet=True)
539540
if tag in tags.splitlines():
540541
util.log(f"Skipping since tag is already merged into {branch}")
541542
return

jupyter_releaser/python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def check_dist(dist_file, test_cmd=""):
5555
# Create the virtual env, upgrade pip,
5656
# install, and run test command
5757
util.run(f"python -m venv {env_path}")
58-
util.run(f"{bin_path}/python -m pip install -U pip")
58+
util.run(f"{bin_path}/python -m pip install -q -U pip")
5959
util.run(f"{bin_path}/pip install -q {dist_file}")
6060
util.run(f"{bin_path}/{test_cmd}")
6161

jupyter_releaser/tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_prep_git_full(py_package, tmp_path, mocker, runner):
7979
call('git config --global user.name "GitHub Action"'),
8080
call("git init .jupyter_releaser_checkout"),
8181
call("git remote add origin https://snuffy:[email protected]/baz/bar.git"),
82-
call("git fetch origin --tags --force"),
82+
call("git fetch origin --tags --force --quiet"),
8383
call("git fetch origin +refs/pull/42:refs/pull/42"),
8484
call("git fetch origin refs/pull/42"),
8585
call("git checkout -B foo refs/pull/42"),

jupyter_releaser/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,15 @@ def run(cmd, **kwargs):
4747
return _run_win(cmd, **kwargs)
4848

4949
quiet = kwargs.get("quiet")
50+
quiet_error = kwargs.get("quiet_error")
5051
kwargs.setdefault("echo", True)
5152
kwargs.setdefault("check", True)
5253

5354
try:
5455
process = tee(cmd, **kwargs)
5556
return (process.stdout or "").strip()
5657
except CalledProcessError as e:
57-
if quiet:
58+
if quiet and not quiet_error:
5859
if e.stderr:
5960
log("stderr:\n", e.stderr.strip(), "\n\n")
6061
if e.stdout:
@@ -245,7 +246,7 @@ def actions_output(name, value):
245246

246247
def get_latest_tag(branch):
247248
"""Get the default 'since' value for a branch"""
248-
tags = run(f"git --no-pager tag --sort=-creatordate --merged {branch}")
249+
tags = run(f"git --no-pager tag --sort=-creatordate --merged {branch}", quiet=True)
249250
if tags:
250251
return tags.splitlines()[0]
251252

0 commit comments

Comments
 (0)