mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-22 23:55:46 +00:00
First cut at a py2app setup. picard/disc.py now has a special case for finding libdiscid in the app bundle
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
import ctypes
|
||||
import sys
|
||||
import os
|
||||
from PyQt4 import QtCore
|
||||
from picard.ui.cdlookup import CDLookupDialog
|
||||
|
||||
@@ -75,6 +76,16 @@ def _openLibrary():
|
||||
|
||||
@raise NotImplementedError: if the library can't be opened
|
||||
"""
|
||||
|
||||
# Check to see if we're running in a Mac OS X bundle.
|
||||
if sys.platform == 'darwin':
|
||||
try:
|
||||
libDiscId = ctypes.cdll.LoadLibrary('../Frameworks/libdiscid.1.dylib')
|
||||
_setPrototypes(libDiscId)
|
||||
return libDiscId
|
||||
except OSError, e:
|
||||
pass
|
||||
|
||||
# This only works for ctypes >= 0.9.9.3. Any libdiscid is found,
|
||||
# no matter how it's called on this platform.
|
||||
try:
|
||||
@@ -92,7 +103,7 @@ def _openLibrary():
|
||||
if sys.platform == 'linux2':
|
||||
libName = 'libdiscid.so.0'
|
||||
elif sys.platform == 'darwin':
|
||||
libName = 'libdiscid.0.dylib'
|
||||
libName = 'libdiscid.1.dylib'
|
||||
elif sys.platform == 'win32':
|
||||
libName = 'discid.dll'
|
||||
else:
|
||||
|
||||
40
setup.py
40
setup.py
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import glob, re
|
||||
import os.path
|
||||
@@ -16,11 +17,33 @@ args = {}
|
||||
|
||||
|
||||
try:
|
||||
import py2app
|
||||
args['app'] = ['scripts/picard']
|
||||
except ImportError:
|
||||
py2app = None
|
||||
from py2app.build_app import py2app
|
||||
do_py2app = True
|
||||
args['app'] = ['tagger.py']
|
||||
args['name'] = 'Picard'
|
||||
args['options'] = { 'py2app' :
|
||||
{
|
||||
'optimize' : 2,
|
||||
'argv_emulation' : True,
|
||||
'iconfile' : 'picard.icns',
|
||||
'frameworks' : ['/opt/local/lib/libofa.0.dylib', 'libiconv.2.dylib', '/opt/local/lib/libdiscid.1.dylib'],
|
||||
'includes' : ['sip', 'PyQt4._qt', 'picard.util.astrcmp', 'picard.musicdns.ofa', 'picard.musicdns.avcodec' ],
|
||||
'excludes' : ['pydoc'],
|
||||
'plist' : { 'CFBundleName' : 'MusicBrainz Picard',
|
||||
'CFBundleGetInfoString' : 'Picard, the next generation MusicBrainz tagger (see http://wiki.musicbrainz.org/PicardTagger',
|
||||
'CFBundleIdentifier':'org.musicbrainz.picard',
|
||||
'CFBundleShortVersionString':__version__,
|
||||
'CFBundleVersion': 'Picard ' + __version__,
|
||||
'LSMinimumSystemVersion':'10.4.3',
|
||||
'LSMultipleInstancesProhibited':'true',
|
||||
# RAK: It biffed when I tried to include your accented characters, luks. :-(
|
||||
'NSHumanReadableCopyright':'Copyright 2008 Lukas Lalinsky, Robert Kaye',
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
except ImportError:
|
||||
do_py2app = False
|
||||
|
||||
# this must be imported *after* py2app, because py2app imports setuptools
|
||||
# which "patches" (read: screws up) the Extension class
|
||||
@@ -475,9 +498,16 @@ try:
|
||||
except ImportError:
|
||||
py2exe = None
|
||||
|
||||
if do_py2app:
|
||||
class BuildAPP(py2app):
|
||||
def run(self):
|
||||
py2app.run(self)
|
||||
|
||||
args['scripts'] = [ 'tagger.py' ]
|
||||
args['cmdclass'] = { 'py2app' : BuildAPP }
|
||||
|
||||
# FIXME: this should check for the actual command ('install' vs. 'bdist_nsis', 'py2app', ...), not installed libraries
|
||||
if py2exe is None and py2app is None:
|
||||
if py2exe is None and do_py2app is None:
|
||||
args['data_files'].append(('share/icons', ('picard-16.png', 'picard-32.png')))
|
||||
args['data_files'].append(('share/applications', ('picard.desktop',)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user