Skip to content

Commit 24ecdc0

Browse files
authored
Prepend tag with Python package name if multiple packages are defined (#570)
1 parent 897a828 commit 24ecdc0

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

jupyter_releaser/cli.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,18 @@ def prep_git(ref, branch, repo, auth, username, git_url):
377377
def bump_version(version_spec, version_cmd, changelog_path, python_packages, tag_format):
378378
"""Prep git and env variables and bump version"""
379379
prev_dir = os.getcwd()
380-
for python_package in [p.split(":")[0] for p in python_packages]:
381-
os.chdir(python_package)
382-
lib.bump_version(version_spec, version_cmd, changelog_path, tag_format)
380+
for package in python_packages:
381+
package_path, package_name = (
382+
package.split(":", maxsplit=2) if ":" in package else [package, None]
383+
)
384+
os.chdir(package_path)
385+
lib.bump_version(
386+
version_spec,
387+
version_cmd,
388+
changelog_path,
389+
tag_format,
390+
package_name=package_name if len(python_packages) > 1 else None,
391+
)
383392
os.chdir(prev_dir)
384393

385394

jupyter_releaser/lib.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from jupyter_releaser import changelog, npm, python, util
2424

2525

26-
def bump_version(version_spec, version_cmd, changelog_path, tag_format):
26+
def bump_version(version_spec, version_cmd, changelog_path, tag_format, package_name=None):
2727
"""Bump the version and verify new version"""
2828
util.bump_version(version_spec, version_cmd=version_cmd, changelog_path=changelog_path)
2929

@@ -38,6 +38,8 @@ def bump_version(version_spec, version_cmd, changelog_path, tag_format):
3838

3939
# Bail if tag already exists
4040
tag_name = tag_format.format(version=version)
41+
if package_name:
42+
tag_name = package_name + "-" + tag_name
4143
if tag_name in util.run("git --no-pager tag", quiet=True).splitlines():
4244
msg = f"Tag {tag_name} already exists!"
4345
msg += " To delete run: `git push --delete origin {tag_name}`"

0 commit comments

Comments
 (0)