mirror of https://github.com/mgba-emu/mgba.git
All: Add --verbose flag to deploy-mac.py, off by default
This commit is contained in:
parent
38a4e9988f
commit
c9b7f450aa
|
@ -8,6 +8,7 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
qtPath = None
|
qtPath = None
|
||||||
|
verbose = False
|
||||||
|
|
||||||
def splitPath(path):
|
def splitPath(path):
|
||||||
folders = []
|
folders = []
|
||||||
|
@ -81,6 +82,7 @@ def parseOtoolLine(line, execPath, root):
|
||||||
return joinPath(split), newPath, path, newExecPath
|
return joinPath(split), newPath, path, newExecPath
|
||||||
|
|
||||||
def updateMachO(bin, execPath, root):
|
def updateMachO(bin, execPath, root):
|
||||||
|
global qtPath
|
||||||
otoolOutput = subprocess.check_output([otool, '-L', bin])
|
otoolOutput = subprocess.check_output([otool, '-L', bin])
|
||||||
toUpdate = []
|
toUpdate = []
|
||||||
for line in otoolOutput.split('\n'):
|
for line in otoolOutput.split('\n'):
|
||||||
|
@ -88,8 +90,10 @@ def updateMachO(bin, execPath, root):
|
||||||
if not newPath:
|
if not newPath:
|
||||||
continue
|
continue
|
||||||
if os.access(newPath, os.F_OK):
|
if os.access(newPath, os.F_OK):
|
||||||
|
if verbose:
|
||||||
print('Skipping copying {}, already done.'.format(oldPath))
|
print('Skipping copying {}, already done.'.format(oldPath))
|
||||||
elif os.path.abspath(oldPath) != os.path.abspath(newPath):
|
elif os.path.abspath(oldPath) != os.path.abspath(newPath):
|
||||||
|
if verbose:
|
||||||
print('Copying {} to {}...'.format(oldPath, newPath))
|
print('Copying {} to {}...'.format(oldPath, newPath))
|
||||||
parent, child = os.path.split(newPath)
|
parent, child = os.path.split(newPath)
|
||||||
makedirs(parent)
|
makedirs(parent)
|
||||||
|
@ -97,15 +101,17 @@ def updateMachO(bin, execPath, root):
|
||||||
os.chmod(newPath, 0o644)
|
os.chmod(newPath, 0o644)
|
||||||
toUpdate.append((newPath, oldExecPath, newExecPath))
|
toUpdate.append((newPath, oldExecPath, newExecPath))
|
||||||
if not qtPath and 'Qt' in oldPath:
|
if not qtPath and 'Qt' in oldPath:
|
||||||
global qtPath
|
|
||||||
qtPath = findQtPath(oldPath)
|
qtPath = findQtPath(oldPath)
|
||||||
|
if verbose:
|
||||||
print('Found Qt path at {}.'.format(qtPath))
|
print('Found Qt path at {}.'.format(qtPath))
|
||||||
for path, oldExecPath, newExecPath in toUpdate:
|
for path, oldExecPath, newExecPath in toUpdate:
|
||||||
if path != bin:
|
if path != bin:
|
||||||
updateMachO(path, execPath, root)
|
updateMachO(path, execPath, root)
|
||||||
|
if verbose:
|
||||||
print('Updating Mach-O load from {} to {}...'.format(oldExecPath, newExecPath))
|
print('Updating Mach-O load from {} to {}...'.format(oldExecPath, newExecPath))
|
||||||
subprocess.check_call([installNameTool, '-change', oldExecPath, newExecPath, bin])
|
subprocess.check_call([installNameTool, '-change', oldExecPath, newExecPath, bin])
|
||||||
else:
|
else:
|
||||||
|
if verbose:
|
||||||
print('Updating Mach-O id from {} to {}...'.format(oldExecPath, newExecPath))
|
print('Updating Mach-O id from {} to {}...'.format(oldExecPath, newExecPath))
|
||||||
subprocess.check_call([installNameTool, '-id', newExecPath, bin])
|
subprocess.check_call([installNameTool, '-id', newExecPath, bin])
|
||||||
|
|
||||||
|
@ -115,11 +121,13 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('-I', '--install-name-tool', metavar='INSTALL_NAME_TOOL', default='install_name_tool', help='path to install_name_tool')
|
parser.add_argument('-I', '--install-name-tool', metavar='INSTALL_NAME_TOOL', default='install_name_tool', help='path to install_name_tool')
|
||||||
parser.add_argument('-O', '--otool', metavar='OTOOL', default='otool', help='path to otool')
|
parser.add_argument('-O', '--otool', metavar='OTOOL', default='otool', help='path to otool')
|
||||||
parser.add_argument('-p', '--qt-plugins', metavar='PLUGINS', default='', help='Qt plugins to include (comma-separated)')
|
parser.add_argument('-p', '--qt-plugins', metavar='PLUGINS', default='', help='Qt plugins to include (comma-separated)')
|
||||||
|
parser.add_argument('-v', '--verbose', action='store_true', default=False, help='output more information')
|
||||||
parser.add_argument('bundle', help='application bundle to deploy')
|
parser.add_argument('bundle', help='application bundle to deploy')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
otool = args.otool
|
otool = args.otool
|
||||||
installNameTool = args.install_name_tool
|
installNameTool = args.install_name_tool
|
||||||
|
verbose = args.verbose
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(os.path.join(args.bundle, 'Contents/Frameworks/'))
|
shutil.rmtree(os.path.join(args.bundle, 'Contents/Frameworks/'))
|
||||||
|
|
Loading…
Reference in New Issue