Skip to content

Commit

Permalink
Merge branch 'master' into feat/lint-repodata-patches
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester authored Aug 9, 2023
2 parents cf7230a + aa08857 commit 4f20d45
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 3 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

### [2.3.4](https://www.github.com/bioconda/bioconda-utils/compare/v2.3.3...v2.3.4) (2023-07-15)


### Bug Fixes

* update pinning for libxml2 due to conda-forge migration ([#903](https://www.github.com/bioconda/bioconda-utils/issues/903)) ([ee226f8](https://www.github.com/bioconda/bioconda-utils/commit/ee226f8e84a0820430c105412f08714a4de34715))

### [2.3.3](https://www.github.com/bioconda/bioconda-utils/compare/v2.3.2...v2.3.3) (2023-07-06)


### Bug Fixes

* adds alternate lookup if base lookup fails ([#896](https://www.github.com/bioconda/bioconda-utils/issues/896)) ([17a1475](https://www.github.com/bioconda/bioconda-utils/commit/17a147508a64bdafb6031c05a75724b25669ec8d))
* update r-base pinning ([#901](https://www.github.com/bioconda/bioconda-utils/issues/901)) ([54d8702](https://www.github.com/bioconda/bioconda-utils/commit/54d870205d823b6f292df5258b980cbbaa97df77))

### [2.3.2](https://www.github.com/bioconda/bioconda-utils/compare/v2.3.1...v2.3.2) (2023-06-29)


Expand Down
9 changes: 8 additions & 1 deletion bioconda_utils/bioconda_utils-conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ bamtools:
# NOTE: Workaround https://github.com/conda/conda-build/issues/3974 we slightly alter the values
# from conda-forge-pinnings here (inserting '.*' or ' ' which should be ignored later on).
r_base:
- "4.2.*"
- "4.3.*"

# Note: this is a (hopefully) temporary fix for the r-base 4.3 migration. That package was built
# with libxml2 2.11, but that migration on conda-forge isn't yet complete. Consequently conda-forge-pinning
# still has libxml2 2.10. That means that there are a number of R and Bioconductor packages we can't currently
# build without manually changing out libxml2 pinning.
libxml2:
- "2.11.*"

python:
- 3.10.* *_cpython
Expand Down
2 changes: 1 addition & 1 deletion bioconda_utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def build(recipe_folder, config, packages="*", git_range=None, testonly=False,
logger.warning(f"Using tag {image_tag} for docker image, since there is no image for a not yet release version ({VERSION}).")
else:
image_tag = VERSION
docker_base_image = f"quay.io/bioconda/bioconda-utils-build-env-cos7:{image_tag}"
docker_base_image = docker_base_image or f"quay.io/bioconda/bioconda-utils-build-env-cos7:{image_tag}"
logger.info(f"Using docker image {docker_base_image} for building.")

docker_builder = docker_utils.RecipeBuilder(
Expand Down
54 changes: 54 additions & 0 deletions bioconda_utils/hosters.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,61 @@ class GithubBase(OrderedHTMLHoster):
class GithubRelease(GithubBase):
"""Matches release artifacts uploaded to Github"""
link_pattern = r"/{account}/{project}/releases/download/{tag}/{fname}{ext}?"
alt_releases_formats = ["https://api.github.com/repos/{account}/{project}/releases"]

async def get_versions(self, req, orig_version):
# first, try the older version when HTML worked
matches = await super().get_versions(req, orig_version)
if len(matches) > 0:
return matches

# old version found nothing, try with the alternate github API URLs which return JSON
self.releases_urls = [
template.format_map(self.vals)
for template in self.alt_releases_formats
]

# this is basically copied from a mixture of the base version and the JSON version
# need to compile the link regex
exclude = set(self.exclude)
vals = {key: val
for key, val in self.vals.items()
if key not in exclude}
link_pattern = replace_named_capture_group(self.link_pattern_compiled, vals)
link_re = re.compile(link_pattern)

# now iterate over the alter release URLs
matches = []
for url in self.releases_urls:
text = await req.get_text_from_url(url)
data = json.loads(text)

# structured as an array of tagged releases
for tag_dict in data:
# each release has an asset dict
for asset_dict in tag_dict.get('assets', []):
# there is a direct download link for each asset, which should make the typical pattern for an HTML user
download_url = asset_dict['browser_download_url']
re_match = link_re.search(download_url)

if re_match:
# this one matches the pattern
# link - just copy the download_url in full
# version - pull out of the regex match
data = re_match.groupdict()
matches.append({
'link' : download_url,
'version' : data['version']
})

# now strip down to the version(s) that are more recent than what currently is in bioconda
num = None
for num, match in enumerate(matches):
if match["version"] == self.vals["version"]:
break
if num is None:
return matches
return matches[:num + 1]

class GithubTag(GithubBase):
"""Matches GitHub repository archives created automatically from tags"""
Expand Down
2 changes: 1 addition & 1 deletion test/test_bioconductor_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_meta_contents(tmpdir, bioc_fetch):
@pytest.mark.skip(reason="Does not currently work inside of the CI (cannot find the release) although it seems to work fine locally.")
def test_find_best_bioc_version():

assert bioconductor_skeleton.find_best_bioc_version('DESeq2', '1.36.0') == '3.15'
assert bioconductor_skeleton.find_best_bioc_version('DESeq2', '1.40.1') == '3.17'

# Non-existent version:
with pytest.raises(bioconductor_skeleton.PackageNotFoundError):
Expand Down

0 comments on commit 4f20d45

Please sign in to comment.