2 py2app/py2exe build script for Electrum Litecoin
11 import sys, os, shutil, re
12 from setuptools import setup
13 from lib.version import ELECTRUM_VERSION as version
14 from lib.util import print_error
18 mainscript = 'electrum'
20 if sys.version_info[:3] < (2,6,0):
21 print_error("Error: " + name + " requires Python version >= 2.6.0...")
24 if sys.platform == 'darwin':
25 shutil.copy(mainscript, mainscript + '.py')
28 setup_requires=['py2app'],
30 options=dict(py2app=dict(argv_emulation=True,
31 iconfile='electrum.icns',
32 resources=["data/background.png", "data/style.css", "data/icons"])),
34 elif sys.platform == 'win32':
36 setup_requires=['py2exe'],
41 # Normally unix-like platforms will use "setup.py install"
42 # and install the main script as such
52 if sys.platform == 'darwin':
53 # Remove the copied py file
55 resource = "dist/" + name + ".app/Contents/Resources/"
57 # Try to locate qt_menu
58 # Let's try the port version first!
59 if os.path.isfile("/opt/local/lib/Resources/qt_menu.nib"):
60 qt_menu_location = "/opt/local/lib/Resources/qt_menu.nib"
62 # No dice? Then let's try the brew version
63 qt_menu_location = os.popen("mdfind -name qt_menu.nib | grep Cellar | head").read()
64 qt_menu_location = re.sub('\n','', qt_menu_location)
66 if(len(qt_menu_location) == 0):
67 print "Sorry couldn't find your qt_menu.nib this probably won't work"
69 # Need to include a copy of qt_menu.nib
70 shutil.copytree(qt_menu_location, resource + "qt_menu.nib")
71 # Need to touch qt.conf to avoid loading 2 sets of Qt libraries
72 fname = resource + "qt.conf"
73 with file(fname, 'a'):