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

add flag to FSFileProvider to mangle .dmg and .iso filenames #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions SharedProcessors/FSFileProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class FSFileProvider(Processor):
'required': False,
'default': 'match',
},
'mangle_dmg_iso_filenames': {
'description': 'Currently, the DmgCopier tries to look inside paths ending .dmg or .iso; setting this flag will change the output filename from file.iso to file.i?o and file.dmg to file.d?g which works around this',
'required': False,
'default': 'False',
},
}

output_variables = {
Expand Down Expand Up @@ -75,10 +80,16 @@ def main(self):
if output_var_name not in groupdict.keys():
groupdict[output_var_name] = groupmatch

self.output('Mangle: %s' % self.env['mangle_dmg_iso_filenames'])
self.output_variables = {}
for key in groupdict.keys():
self.env[key] = groupdict[key]
self.output('Found matching text (%s): %s' % (key, self.env[key], ))
if self.env['mangle_dmg_iso_filenames'] == True and key == 'file':
self.env[key] = re.sub('iso$', 'i?o', self.env[key], flags=re.I)
self.env[key] = re.sub('dmg$', 'd?g', self.env[key], flags=re.I)
self.output('Updated: matching text (%s): %s' % (key, self.env[key], ))

self.output_variables[key] = {
'description': 'Matched regular expression group'}

Expand Down