def copy_file(self, *args, **kwargs): # Override to UPX copied binaries. (fname, copied) = result = py2exe.copy_file(self, *args, **kwargs) basename = os.path.basename(fname) if (copied and self.upx and (basename[:6]+basename[-4:]).lower() != 'python.dll' and fname[-4:].lower() in ('.pyd', '.dll')): os.system('upx --best "%s"' % os.path.normpath(fname)) return result
def copy_file(self, *args, **kwargs): # Override to UPX copied binaries. fname, copied = result = py2exe.copy_file(self, *args, **kwargs) basename = os.path.basename(fname) if not copied or not self.upx: return result if basename[:6] + basename[-4:].lower() == 'python.dll': return result if fname[-4:].lower() not in ('.pyd', '.dll'): return result if basename in self.upx_excludes: print 'excluded', basename return result else: print 'included', basename os.system('upx.exe %s "%s"' % (self.upx_options, os.path.normpath(fname))) return result