Skip to content

Commit

Permalink
Merge pull request #46 from Hind-M/fetch_rc
Browse files Browse the repository at this point in the history
Handle dev and pre releases
  • Loading branch information
JohanMabille authored Jul 16, 2024
2 parents 9788d58 + 33fc018 commit 0a0ec9e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions fetch_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_all_tags_github():
return set(tags)


def extract_with_microamamba(archive, outdir):
def extract_with_micromamba(archive, outdir):
subprocess.check_call(
["micromamba", "package", "extract", str(archive), str(outdir)]
)
Expand All @@ -41,7 +41,7 @@ def set_output(name, value):
print(f"{name}={value}\n", file=fh)


def get_micromamba(version="latest"):
def get_micromamba(version, use_default_version):
url = f"https://api.anaconda.org/release/conda-forge/micromamba/{version}"
existing_tags = get_all_tags_github()
print("Getting Anaconda.org API")
Expand All @@ -60,7 +60,7 @@ def get_micromamba(version="latest"):
assert len(all_versions) == 1
version = all_versions.pop()

if (v := Version(version)).is_devrelease or v.is_prerelease:
if use_default_version and ((v := Version(version)).is_devrelease or v.is_prerelease):
print(f"Skipping dev and pre releases version '{version}'")
set_output("MICROMAMBA_NEW_VERSION", "false")
return
Expand Down Expand Up @@ -108,7 +108,7 @@ def get_micromamba(version="latest"):

# extract the file
extract_dir = Path(f"micromamba-{version}-{build_number}-{dplat}")
extract_with_microamamba(dlloc, extract_dir)
extract_with_micromamba(dlloc, extract_dir)

# move the file to the right place
if dplat != "win-64":
Expand Down Expand Up @@ -142,6 +142,6 @@ def get_micromamba(version="latest"):

if __name__ == "__main__":
if len(sys.argv) > 1:
get_micromamba(sys.argv[1])
get_micromamba(sys.argv[1], False)
else:
get_micromamba()
get_micromamba("latest", True)

0 comments on commit 0a0ec9e

Please sign in to comment.