Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Dec 12, 2024
1 parent c13d944 commit dce5e90
Showing 1 changed file with 29 additions and 14 deletions.
43 changes: 29 additions & 14 deletions galaxy_release_util/point_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def bump_package_version(package: Package, new_version: Version):
package.modified_paths.append(package.setup_cfg)


def get_commits_since_last_version(package: Package, last_version_tag: str):
def get_commits_since_last_version(package: Package, last_version_tag: str) -> Set[str]:
click.echo(f"finding commits to package {package.name} made since {last_version_tag}")
package_source_paths = []
commits = set()
Expand Down Expand Up @@ -273,7 +273,7 @@ def get_commits_since_last_version(package: Package, last_version_tag: str):
for line in result.stdout.splitlines():
if line:
commits.add(line)
package.commits = commits
return commits


def commits_to_prs(packages: List[Package]):
Expand Down Expand Up @@ -365,14 +365,13 @@ def get_root_version(galaxy_root: pathlib.Path) -> Version:
return Version(f"{major_version}.{minor_version}")


def set_root_version(galaxy_root: pathlib.Path, new_version: Version) -> pathlib.Path:
def set_root_version(version_py: pathlib.Path, new_version: Version) -> pathlib.Path:
major_galaxy_release_string = f"{new_version.major}.{new_version.minor}"
minor_galaxy_release_string = str(new_version).replace(f"{major_galaxy_release_string}.", "")
VERSION_PY_TEMPLATE = f"""VERSION_MAJOR = "{major_galaxy_release_string}"
VERSION_MINOR = "{minor_galaxy_release_string}"
VERSION = VERSION_MAJOR + (f".{{VERSION_MINOR}}" if VERSION_MINOR else "")
"""
version_py = version_filepath(galaxy_root)
version_py.write_text(VERSION_PY_TEMPLATE)
return version_py

Expand Down Expand Up @@ -643,16 +642,20 @@ def create_point_release(
ensure_branches_up_to_date(all_branches, base_branch, upstream, galaxy_root)
ensure_clean_merges(newer_branches, base_branch, galaxy_root, no_confirm)

modified_paths = [set_root_version(galaxy_root, new_version)]
# read packages and find prs that affect a package
packages: List[Package] = []
for package_path in get_sorted_package_paths(galaxy_root):
if package_subset and package_path.name not in package_subset:
continue
package = read_package(package_path)
packages.append(package)
get_commits_since_last_version(package, last_commit)
version_py = version_filepath(galaxy_root)
set_root_version(version_py, new_version)
modified_paths = [version_py]

packages = load_packages(galaxy_root, package_subset, last_commit)


return # TODO REMOVE


commits_to_prs(packages)



# update package versions and changelog files
for package in packages:
if new_version:
Expand Down Expand Up @@ -685,7 +688,7 @@ def create_point_release(

subprocess.run(["git", "tag", release_tag], cwd=galaxy_root)
dev_version = get_next_devN_version(galaxy_root)
version_py = set_root_version(galaxy_root, dev_version)
version_py = set_root_version(version_py, dev_version)
modified_paths = [version_py]
for package in packages:
bump_package_version(package, dev_version)
Expand Down Expand Up @@ -730,5 +733,17 @@ def get_user_confirmation(galaxy_root: pathlib.Path, new_version: Version, base_
click.confirm("Does this look correct?", abort=True)


def load_packages(galaxy_root: pathlib.Path, package_subset: List[str], last_commit: str) -> List[Package]:
""" Read packages and find prs that affect a package. """
packages: List[Package] = []
for package_path in get_sorted_package_paths(galaxy_root):
if package_subset and package_path.name not in package_subset:
continue
package = read_package(package_path)
packages.append(package)
package.commits = get_commits_since_last_version(package, last_commit)
return packages


if __name__ == "__main__":
cli()

0 comments on commit dce5e90

Please sign in to comment.