diff --git a/AO2XP.icns b/AO2XP.icns new file mode 100644 index 0000000..061d9f5 Binary files /dev/null and b/AO2XP.icns differ diff --git a/AO2XP.py b/AO2XP.py index 1685707..d7cbd39 100644 --- a/AO2XP.py +++ b/AO2XP.py @@ -1,5 +1,6 @@ import sys, thread, time, os, platform from os.path import exists + from PyQt4 import QtGui, QtCore app = QtGui.QApplication(sys.argv) @@ -7,16 +8,17 @@ osname = platform.system() bassdll = "bass.dll" if osname != "Windows": bassdll = "libbass.so" -if osname == "Darwin" and ".app" in __file__: # bundle - path = "/".join(__file__.split("/")[:-4]) - sys.stderr.write(path) + +path = sys.argv[0] +if osname == "Darwin" and ".app" in path: # bundle + path = "/".join(path.split("/")[:-1]) # to Resources folder os.chdir(path) debugmode = len(sys.argv) > 1 and sys.argv[1] == "debug" if not debugmode: fakebass = len(sys.argv) > 1 and sys.argv[1] == "bass" if not exists(bassdll) or fakebass: - QtGui.QMessageBox.critical(None, "Unable to launch game", "Couldn't find the file %s on the client folder.\nAO2XP needs this file in order to play sounds and music.\nThe file is included in the client's zip file, make sure it's in the same folder as the AO2XP exe." % bassdll) + QtGui.QMessageBox.critical(None, "Unable to launch game", "Couldn't find the file %s on the client folder.\nAO2XP needs this file in order to play sounds and music.\nThe file is included in the client's zip file, make sure it's in the same folder as the AO2XP exe.\n\nAdditional info:\n%s\n%s" % (bassdll, sys.argv, os.getcwd())) os._exit(-2) class gamewindow(QtGui.QMainWindow): diff --git a/quicksetup.py b/quicksetup.py index dc19497..da4210c 100644 --- a/quicksetup.py +++ b/quicksetup.py @@ -71,8 +71,8 @@ zip_ref.extract(BASSOPUSDLL) zip_ref.close() if platform.system() == "Darwin": - os.rename(BASSDLL, "libbass.so") - os.rename(BASSOPUSDLL, "libbassopus.so") + open("libbass.so", "wb").write(open(BASSDLL, "rb").read()) + open("libbassopus.so", "wb").write(open(BASSOPUSDLL, "rb").read()) print "installing apng" pip_install("apng") @@ -91,8 +91,8 @@ except ImportError: print "installing Pillow 5.3.0" pip_install("Pillow==5.3.0") -print "installing pyinstaller" -pip_install('pyinstaller') +print "installing pyinstaller, six, appdirs, packaging" +pip_install('pyinstaller==2.1' if platform.system() == "Darwin" else 'pyinstaller==3.6' + 'six appdirs packaging') if platform.system() == "Windows": print "downloading pyqt4" diff --git a/setup_mac.py b/setup_mac.py index 8d4ceab..236eae9 100644 --- a/setup_mac.py +++ b/setup_mac.py @@ -10,11 +10,9 @@ from setuptools import setup APP = ['AO2XP.py'] DATA_FILES = [] OPTIONS = dict( + iconfile = "AO2XP.icns", + includes = [ - "zlib", - "sip", - "PyQt4", - "PyQt4._qt", "PyQt4.QtCore", "PyQt4.QtGui", ], @@ -31,7 +29,12 @@ OPTIONS = dict( "PyQt4.phonon", ], - packages = [ + resources = [ + "AO2XPbase", + "libbass.so", + "libbass.dylib", + "libbassopus.so", + "libbassopus.dylib", ], argv_emulation = False