Skip to content

Commit 55c280c

Browse files
committed
fix: keep existing patches during bioconductor updates
1 parent 99d4357 commit 55c280c

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

bioconda_utils/bioconductor_skeleton.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ def __init__(self, package, bioc_version=None, pkg_version=None, packages=None):
422422
self.package_lower = package.lower()
423423
self.version = pkg_version
424424
self.extra = None
425+
self.patches = None
425426
self.needsX = False
426427

427428
# If no version specified, assume the latest
@@ -1025,14 +1026,21 @@ def sub_placeholders(x):
10251026
if self.extra:
10261027
d['extra'] = self.extra
10271028

1029+
# Keep patches from existing meta.yaml
1030+
if self.patches:
1031+
d['source']['patches'] = self.patches
1032+
10281033
if self._cb3_build_reqs:
10291034
d['requirements']['build'] = []
10301035
else:
10311036
d['build']['noarch'] = 'generic'
10321037
for k, v in self._cb3_build_reqs.items():
10331038
d['requirements']['build'].append(k + '_' + "PLACEHOLDER")
10341039

1035-
rendered = pyaml.dumps(d, width=1e6) #.decode('utf-8') # decoding seems no longer needed
1040+
# sort requirements sections to match standard order
1041+
d['requirements'] = OrderedDict(sorted(d['requirements'].items()))
1042+
1043+
rendered = pyaml.dumps(d, width=1e6, sort_keys=False)
10361044

10371045
# Add Suggests: and SystemRequirements:
10381046
renderedsplit = rendered.split('\n')
@@ -1274,6 +1282,9 @@ def write_recipe(package, recipe_dir, config, bioc_data_packages=None, force=Fal
12741282
else:
12751283
proj.build_number = sorted([int(i) for i in existing_bldnos]) [-1] + 1
12761284

1285+
if 'source' in current_meta and 'patches' in current_meta['source']:
1286+
proj.patches = current_meta['source']['patches']
1287+
12771288
if 'extra' in current_meta:
12781289
exclude = set(['final', 'copy_test_source_files'])
12791290
proj.extra = {x: y for x, y in current_meta['extra'].items() if x not in exclude}

0 commit comments

Comments
 (0)