1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-02-01 11:56:45 +01:00

Add some logging to macdeploy.py

This commit is contained in:
David Sansome 2012-11-24 17:46:25 +11:00
parent a6eea2b941
commit d97e1f2323

58
dist/macdeploy.py vendored
View File

@ -15,12 +15,15 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Clementine. If not, see <http://www.gnu.org/licenses/>. # along with Clementine. If not, see <http://www.gnu.org/licenses/>.
import logging
import os import os
import re import re
import subprocess import subprocess
import sys import sys
import traceback import traceback
LOGGER = logging.getLogger("macdeploy")
FRAMEWORK_SEARCH_PATH=[ FRAMEWORK_SEARCH_PATH=[
'/target', '/target',
'/Library/Frameworks', '/Library/Frameworks',
@ -197,6 +200,7 @@ def FindFramework(path):
for search_path in FRAMEWORK_SEARCH_PATH: for search_path in FRAMEWORK_SEARCH_PATH:
abs_path = os.path.join(search_path, path) abs_path = os.path.join(search_path, path)
if os.path.exists(abs_path): if os.path.exists(abs_path):
LOGGER.debug("Found framework '%s' in '%s'", path, search_path)
return abs_path return abs_path
raise CouldNotFindFrameworkError(path) raise CouldNotFindFrameworkError(path)
@ -207,6 +211,7 @@ def FindLibrary(path):
for search_path in LIBRARY_SEARCH_PATH: for search_path in LIBRARY_SEARCH_PATH:
abs_path = os.path.join(search_path, path) abs_path = os.path.join(search_path, path)
if os.path.exists(abs_path): if os.path.exists(abs_path):
LOGGER.debug("Found library '%s' in '%s'", path, search_path)
return abs_path return abs_path
raise CouldNotFindFrameworkError(path) raise CouldNotFindFrameworkError(path)
@ -272,6 +277,7 @@ def CopyLibrary(path):
new_path = os.path.join(frameworks_dir, os.path.basename(path)) new_path = os.path.join(frameworks_dir, os.path.basename(path))
args = ['ditto', '--arch=x86_64', path, new_path] args = ['ditto', '--arch=x86_64', path, new_path]
commands.append(args) commands.append(args)
LOGGER.info("Copying library '%s'", path)
return new_path return new_path
def CopyPlugin(path, subdir): def CopyPlugin(path, subdir):
@ -280,6 +286,7 @@ def CopyPlugin(path, subdir):
commands.append(args) commands.append(args)
args = ['ditto', '--arch=x86_64', path, new_path] args = ['ditto', '--arch=x86_64', path, new_path]
commands.append(args) commands.append(args)
LOGGER.info("Copying plugin '%s'", path)
return new_path return new_path
def CopyFramework(path): def CopyFramework(path):
@ -298,6 +305,7 @@ def CopyFramework(path):
args = ['cp', '-r', menu_nib, resources_dir] args = ['cp', '-r', menu_nib, resources_dir]
commands.append(args) commands.append(args)
LOGGER.info("Copying framework '%s'", path)
return os.path.join(full_path, parts[-1]) return os.path.join(full_path, parts[-1])
def FixId(path, library_name): def FixId(path, library_name):
@ -377,32 +385,40 @@ def FindGioModule(name):
raise CouldNotFindGioModuleError(name) raise CouldNotFindGioModuleError(name)
FixBinary(binary) def main():
logging.basicConfig(filename="macdeploy.log", level=logging.DEBUG,
format='%(asctime)s %(levelname)-8s %(message)s')
for plugin in GSTREAMER_PLUGINS: FixBinary(binary)
FixPlugin(FindGstreamerPlugin(plugin), 'gstreamer')
FixPlugin(FindGstreamerPlugin('gst-plugin-scanner'), '.') for plugin in GSTREAMER_PLUGINS:
FixPlugin(FindGioModule('libgiognutls.so'), 'gio-modules') FixPlugin(FindGstreamerPlugin(plugin), 'gstreamer')
FixPlugin(FindGioModule('libgiolibproxy.so'), 'gio-modules')
try: FixPlugin(FindGstreamerPlugin('gst-plugin-scanner'), '.')
FixPlugin('clementine-spotifyblob', '.') FixPlugin(FindGioModule('libgiognutls.so'), 'gio-modules')
FixPlugin('clementine-tagreader', '.') FixPlugin(FindGioModule('libgiolibproxy.so'), 'gio-modules')
except:
print 'Failed to find blob: %s' % traceback.format_exc()
for plugin in QT_PLUGINS: try:
FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin)) FixPlugin('clementine-spotifyblob', '.')
FixPlugin('clementine-tagreader', '.')
except:
print 'Failed to find blob: %s' % traceback.format_exc()
for plugin in QT_PLUGINS:
FixPlugin(FindQtPlugin(plugin), os.path.dirname(plugin))
if len(sys.argv) <= 2:
print 'Would run %d commands:' % len(commands)
for command in commands:
print ' '.join(command)
print 'OK?'
raw_input()
if len(sys.argv) <= 2:
print 'Would run %d commands:' % len(commands)
for command in commands: for command in commands:
print ' '.join(command) p = subprocess.Popen(command)
os.waitpid(p.pid, 0)
print 'OK?'
raw_input()
for command in commands: if __name__ == "__main__":
p = subprocess.Popen(command) main()
os.waitpid(p.pid, 0)