add .icns file, pack libs inside .app file

This commit is contained in:
Headshot 2021-02-17 07:16:27 -04:30
parent 001c4c11cd
commit 993df1538f
4 changed files with 18 additions and 13 deletions

BIN
AO2XP.icns Normal file

Binary file not shown.

View File

@ -1,5 +1,6 @@
import sys, thread, time, os, platform import sys, thread, time, os, platform
from os.path import exists from os.path import exists
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)
@ -7,16 +8,17 @@ osname = platform.system()
bassdll = "bass.dll" bassdll = "bass.dll"
if osname != "Windows": if osname != "Windows":
bassdll = "libbass.so" bassdll = "libbass.so"
if osname == "Darwin" and ".app" in __file__: # bundle
path = "/".join(__file__.split("/")[:-4]) path = sys.argv[0]
sys.stderr.write(path) if osname == "Darwin" and ".app" in path: # bundle
path = "/".join(path.split("/")[:-1]) # to Resources folder
os.chdir(path) os.chdir(path)
debugmode = len(sys.argv) > 1 and sys.argv[1] == "debug" debugmode = len(sys.argv) > 1 and sys.argv[1] == "debug"
if not debugmode: if not debugmode:
fakebass = len(sys.argv) > 1 and sys.argv[1] == "bass" fakebass = len(sys.argv) > 1 and sys.argv[1] == "bass"
if not exists(bassdll) or fakebass: 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) os._exit(-2)
class gamewindow(QtGui.QMainWindow): class gamewindow(QtGui.QMainWindow):

View File

@ -71,8 +71,8 @@ zip_ref.extract(BASSOPUSDLL)
zip_ref.close() zip_ref.close()
if platform.system() == "Darwin": if platform.system() == "Darwin":
os.rename(BASSDLL, "libbass.so") open("libbass.so", "wb").write(open(BASSDLL, "rb").read())
os.rename(BASSOPUSDLL, "libbassopus.so") open("libbassopus.so", "wb").write(open(BASSOPUSDLL, "rb").read())
print "installing apng" print "installing apng"
pip_install("apng") pip_install("apng")
@ -91,8 +91,8 @@ except ImportError:
print "installing Pillow 5.3.0" print "installing Pillow 5.3.0"
pip_install("Pillow==5.3.0") pip_install("Pillow==5.3.0")
print "installing pyinstaller" print "installing pyinstaller, six, appdirs, packaging"
pip_install('pyinstaller') pip_install('pyinstaller==2.1' if platform.system() == "Darwin" else 'pyinstaller==3.6' + 'six appdirs packaging')
if platform.system() == "Windows": if platform.system() == "Windows":
print "downloading pyqt4" print "downloading pyqt4"

View File

@ -10,11 +10,9 @@ from setuptools import setup
APP = ['AO2XP.py'] APP = ['AO2XP.py']
DATA_FILES = [] DATA_FILES = []
OPTIONS = dict( OPTIONS = dict(
iconfile = "AO2XP.icns",
includes = [ includes = [
"zlib",
"sip",
"PyQt4",
"PyQt4._qt",
"PyQt4.QtCore", "PyQt4.QtCore",
"PyQt4.QtGui", "PyQt4.QtGui",
], ],
@ -31,7 +29,12 @@ OPTIONS = dict(
"PyQt4.phonon", "PyQt4.phonon",
], ],
packages = [ resources = [
"AO2XPbase",
"libbass.so",
"libbass.dylib",
"libbassopus.so",
"libbassopus.dylib",
], ],
argv_emulation = False argv_emulation = False