2 py2app/py2exe build script for Electrum Litecoin
11 from setuptools import setup
17 from lib.util import print_error
18 from lib.version import ELECTRUM_VERSION as version
22 mainscript = 'electrum'
24 if sys.version_info[:3] < (2, 6, 0):
25 print_error("Error: " + name + " requires Python version >= 2.6.0...")
28 if sys.platform == 'darwin':
29 from plistlib import Plist
30 plist = Plist.fromFile('Info.plist')
31 plist.update(dict(CFBundleIconFile='electrum.icns'))
33 shutil.copy(mainscript, mainscript + '.py')
36 setup_requires=['py2app'],
38 options=dict(py2app=dict(argv_emulation=True,
39 includes=['PyQt4.QtCore', 'PyQt4.QtGui', 'PyQt4.QtWebKit', 'PyQt4.QtNetwork', 'sip'],
40 packages=['lib', 'gui', 'plugins'],
41 iconfile='electrum.icns',
43 resources=["data", "icons"])),
45 elif sys.platform == 'win32':
47 setup_requires=['py2exe'],
52 # Normally unix-like platforms will use "setup.py install"
53 # and install the main script as such
62 from distutils import dir_util
64 if sys.platform == 'darwin':
65 # Remove the copied py file
67 resource = "dist/" + name + ".app/Contents/Resources/"
69 dir_util.copy_tree("locale", resource + "locale/")
70 # Try to locate qt_menu
71 # Let's try the port version first!
72 if os.path.isfile("/opt/local/lib/Resources/qt_menu.nib"):
73 qt_menu_location = "/opt/local/lib/Resources/qt_menu.nib"
75 # No dice? Then let's try the brew version
76 if os.path.exists("/usr/local/Cellar"):
77 qt_menu_location = os.popen("find /usr/local/Cellar -name qt_menu.nib | tail -n 1").read()
78 # no brew, check /opt/local
80 qt_menu_location = os.popen("find /opt/local -name qt_menu.nib | tail -n 1").read()
81 qt_menu_location = re.sub('\n', '', qt_menu_location)
83 if (len(qt_menu_location) == 0):
84 print "Sorry couldn't find your qt_menu.nib this probably won't work"
86 print "Found your qib: " + qt_menu_location
88 # Need to include a copy of qt_menu.nib
89 shutil.copytree(qt_menu_location, resource + "qt_menu.nib")
90 # Need to touch qt.conf to avoid loading 2 sets of Qt libraries
91 fname = resource + "qt.conf"
92 with file(fname, 'a'):