Skip to content

Instantly share code, notes, and snippets.

@14mRh4X0r
Created May 1, 2012 20:12
Show Gist options
  • Save 14mRh4X0r/2571022 to your computer and use it in GitHub Desktop.
Save 14mRh4X0r/2571022 to your computer and use it in GitHub Desktop.
Patch for MCP to only check for wine when necessary
diff --git a/runtime/commands.py b/runtime/commands.py
index f497962..62ec33a 100644
--- a/runtime/commands.py
+++ b/runtime/commands.py
@@ -248,24 +248,30 @@ class Commands(object):
self.has_jad = False
self.has_ff = False
self.has_astyle = False
+
+ self.fernflower = os.path.normpath(self.config.get('COMMANDS', 'Fernflower'))
+ if verify:
+ self.has_ff = self.checkcommand('fernflower', '%s' % self.fernflower, java=True, single_line=True,
+ error=False)
+
+ self.jad = ''
if self.osname in ['linux']:
- self.wine = os.path.normpath(self.config.get('COMMANDS', 'Wine'))
- if verify:
- self.has_wine = self.checkcommand('wine', '%s --version' % self.wine, error=False)
self.astyle = os.path.normpath(self.config.get('COMMANDS', 'AStyle_linux'))
if verify:
self.has_astyle = self.checkcommand('astyle', '%s --version' % self.astyle, error=False)
- if self.has_wine:
- self.jad = self.wine + ' ' + os.path.normpath(self.config.get('COMMANDS', 'Jad_win'))
- if not self.has_astyle:
- self.astyle = self.wine + ' ' + os.path.normpath(self.config.get('COMMANDS', 'AStyle_win'))
- if verify:
- self.has_astyle = self.checkcommand('astyle', '%s --version' % self.astyle, error=False)
- else:
- # need to set to string so the below CmdJad stuff doesn't error out
- self.jad = ''
+ if not (self.has_ff and self.has_astyle):
+ self.wine = os.path.normpath(self.config.get('COMMANDS', 'Wine'))
+ if verify:
+ self.has_wine = self.checkcommand('wine', '%s --version' % self.wine, error=False)
+ if self.has_wine:
+ self.jad = self.wine + ' ' + os.path.normpath(self.config.get('COMMANDS', 'Jad_win'))
+ if not self.has_astyle:
+ self.astyle = self.wine + ' ' + os.path.normpath(self.config.get('COMMANDS', 'AStyle_win'))
+ if verify:
+ self.has_astyle = self.checkcommand('astyle', '%s --version' % self.astyle, error=False)
else:
self.jad = os.path.normpath(self.config.get('COMMANDS', 'Jad_%s' % self.osname))
self.astyle = os.path.normpath(self.config.get('COMMANDS', 'AStyle_%s' % self.osname))
@@ -276,11 +282,6 @@ class Commands(object):
self.has_jad = self.checkcommand('jad', '%s' % self.jad, single_line=True, check_return=False,
error=False)
- self.fernflower = os.path.normpath(self.config.get('COMMANDS', 'Fernflower'))
- if verify:
- self.has_ff = self.checkcommand('fernflower', '%s' % self.fernflower, java=True, single_line=True,
- error=False)
-
# check requirements
# windows: all requirements supplied
# osx: require python and patch, will error out before now anyway so don't need to check further
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment