fix archiving lilac.yaml for bioc

This commit is contained in:
sukanka 2023-04-28 22:25:42 +08:00
parent f8506f1c45
commit 0786f10510
2 changed files with 11 additions and 2 deletions

View file

@ -20,6 +20,8 @@ import re
import requests
# use | in lilac.yaml
def str_presenter(dumper, data):
"""configures yaml for dumping multiline strings
Ref: https://stackoverflow.com/questions/8640959/how-can-i-control-what-scalar-form-pyyaml-uses-for-my-data"""
@ -32,6 +34,7 @@ yaml.add_representer(str, str_presenter)
yaml.representer.SafeRepresenter.add_representer(
str, str_presenter) # to use with safe_dum
class PkgInfo:
def __init__(self, pkgname=None, depends=None, optdepends=None,
bioc_meta_mirror="https://bioconductor.org",
@ -315,7 +318,9 @@ class PkgInfo:
if new_deps:
docs['repo_depends'] = new_deps
with open(yaml_file, 'w') as f:
yaml.dump(docs, f, sort_keys=False)
stream = yaml.dump(docs, sort_keys=False,
default_flow_style=False, indent=2)
f.write(stream)
def create_temporary_copy(path):

View file

@ -58,7 +58,11 @@ def archive_pkg_yaml(bioconductor_version=3.15, yaml_file="lilac.yaml"):
archive_url = f"https://cran.r-project.org/src/contrib/Archive/{pkg}"
# Bioconductor ARCHIVE
elif 'bioconductor.org' in url:
archive_url = url.replace('release', f"{bioconductor_version}")
# https://bioconductor.org/packages/AffyCompatible
# to
# https://bioconductor.org/packages/3.16/AffyCompatible
archive_url = url.replace(
'packages', f"packages/{bioconductor_version}")
if archive_url:
docs['update_on'][url_idx]['url'] = archive_url
with open(yaml_file, 'w') as f: