Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed Geneious Prime Recipe to support latest version (2020) #128

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
17 changes: 15 additions & 2 deletions Geneious/Geneious.download.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See http://desktop-links.geneious.com/assets/installers/geneious/GeneiousVersion
<key>NAME</key>
<string>Geneious</string>
<key>MAJOR_VERSION</key>
<string>10</string>
<string>2020</string>
<key>RELEASE</key>
<string>release</string>
<key>VERSIONS_URL</key>
Expand All @@ -35,6 +35,19 @@ See http://desktop-links.geneious.com/assets/installers/geneious/GeneiousVersion
<string>%MAJOR_VERSION% %RELEASE% %RELEASE%.*(Geneious.*mac.*dmg)</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>com.github.n8felton.shared/RegexReplace</string>
<key>Arguments</key>
<dict>
<key>replace_pattern</key>
<string>-</string>
<key>source_string</key>
<string>%match%</string>
<key>replace_string</key>
<string>_</string>
</dict>
</dict>
<dict>
<key>Processor</key>
<string>URLDownloader</string>
Expand All @@ -54,7 +67,7 @@ See http://desktop-links.geneious.com/assets/installers/geneious/GeneiousVersion
<key>Arguments</key>
<dict>
<key>input_path</key>
<string>%pathname%/Geneious.app</string>
<string>%pathname%/Geneious*.app</string>
<key>requirement</key>
<string>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"</string>
</dict>
Expand Down
60 changes: 60 additions & 0 deletions SharedProcessors/RegexReplace.py
Original file line number Diff line number Diff line change
@@ -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()