Skip to content

Commit

Permalink
cli: fix git-upgrade-shared-modules
Browse files Browse the repository at this point in the history
closes #412
  • Loading branch information
mvidalgarcia committed Oct 9, 2020
1 parent be6f2d3 commit b1ebf0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions reana/reana_dev/git.py
Expand Up @@ -872,16 +872,16 @@ def git_upgrade_shared_modules(
"""

def _create_commit_or_amend(components):
for component in components:
for c in components:
commit_cmd = 'git commit -m "installation: bump shared modules"'
if amend:
commit_cmd = "git commit --amend --no-edit"

files_to_commit = ["setup.py"]
if os.path.exists(get_srcdir(component) + os.sep + "requirements.txt"):
if os.path.exists(get_srcdir(c) + os.sep + "requirements.txt"):
files_to_commit.append("requirements.txt")
run_command(
f"git add {' '.join(files_to_commit)} && {commit_cmd}", component,
f"git add {' '.join(files_to_commit)} && {commit_cmd}", c,
)

components = select_components(component)
Expand All @@ -897,7 +897,7 @@ def _create_commit_or_amend(components):
)

_create_commit_or_amend(components)
ctx.invoke(git_diff, component=[component])
ctx.invoke(git_diff, component=component)
if push:
git_push_to_origin(components)

Expand Down
12 changes: 10 additions & 2 deletions reana/reana_dev/utils.py
Expand Up @@ -452,10 +452,18 @@ def update_module_in_cluster_components(
),
sys.exit(1)

new_version_obj = Version(new_version)
next_minor_version = ".".join(
[
str(new_version_obj.major),
str(new_version_obj.minor + 1),
str(new_version_obj.micro),
]
)
replace_string(
file_="setup.py",
find=">=.*,<",
replace=f">={new_version},<",
find='>=.*,<.*[^",]',
replace=f">={new_version},<{next_minor_version}",
line_selector_regex=f"{module}.*>=",
component=component,
)
Expand Down

0 comments on commit b1ebf0e

Please sign in to comment.