diff --git a/Geneious/Geneious.download.recipe b/Geneious/Geneious.download.recipe index f50bcc926..615963099 100644 --- a/Geneious/Geneious.download.recipe +++ b/Geneious/Geneious.download.recipe @@ -14,7 +14,7 @@ See http://desktop-links.geneious.com/assets/installers/geneious/GeneiousVersion NAME Geneious MAJOR_VERSION - 10 + 2020 RELEASE release VERSIONS_URL @@ -35,6 +35,19 @@ See http://desktop-links.geneious.com/assets/installers/geneious/GeneiousVersion %MAJOR_VERSION% %RELEASE% %RELEASE%.*(Geneious.*mac.*dmg) + + Processor + com.github.n8felton.shared/RegexReplace + Arguments + + replace_pattern + - + source_string + %match% + replace_string + _ + + Processor URLDownloader @@ -54,7 +67,7 @@ See http://desktop-links.geneious.com/assets/installers/geneious/GeneiousVersion Arguments input_path - %pathname%/Geneious.app + %pathname%/Geneious*.app requirement identifier "com.biomatters.Geneious" and anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] /* exists */ and certificate leaf[field.1.2.840.113635.100.6.1.13] /* exists */ and certificate leaf[subject.OU] = "3BTDDQD3L6" diff --git a/SharedProcessors/RegexReplace.py b/SharedProcessors/RegexReplace.py new file mode 100755 index 000000000..d3673c996 --- /dev/null +++ b/SharedProcessors/RegexReplace.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +from autopkglib import Processor, ProcessorError +import re + +__all__ = ["RegexReplace"] + + +class RegexReplace(Processor): + '''Replaces all occurrences of a given pattern in the passed string.''' + + input_variables = { + 'replace_pattern': { + 'description': 'Regular expression (Python) to match against string.', + 'required': True, + }, + 'source_string': { + 'description': 'String to use for matching.', + 'required': True, + }, + 'replace_string': { + 'description': 'String to use for replacing matches.', + 'required': True, + }, + 'replace_count': { + 'description': ('Count how many occurrences should be replaced,' + 'starting from the left most match in "source_string"'), + 'required': False, + 'default': 0 + }, + 'result_output_var_name': { + 'description': ('The name of the output variable that is returned ' + 'by the replace. If not specified then a default of ' + '"replaced_string" will be used.'), + 'required': False, + 'default': 'replaced_string', + }, + } + output_variables = { + 'result_output_var_name': { + 'description': ( + 'The string with all occurrences of re_pattern replaced with' + 'replace_string. Note the actual name of variable depends on the input ' + 'variable "result_output_var_name" or is assigned a default of ' + '"replaced_string."') + } + } + + def main(self): + output_var_name = self.env['result_output_var_name'] + self.output_variables = {} + self.env[output_var_name] = re.sub(self.env['replace_pattern'], self.env['replace_string'], + self.env['source_string'], + self.env['replace_count']) + self.output_variables[output_var_name] = {'description': 'String with replacements.'} + + +if __name__ == '__main__': + PROCESSOR = RegexReplace() + PROCESSOR.execute_shell()