173 lines
5.0 KiB
Python
173 lines
5.0 KiB
Python
import urllib2
|
|
import zipfile
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
import platform
|
|
|
|
def pip_install(*args):
|
|
print "installing " + ", ".join(args)
|
|
command = [sys.executable, "-m", "pip", "install"]
|
|
command.extend(args)
|
|
subprocess.call(command)
|
|
|
|
pip_install('requests')
|
|
import requests
|
|
|
|
print "downloading pybass"
|
|
filedata = urllib2.urlopen('http://master.dl.sourceforge.net/project/pybass/pybass_055.zip')
|
|
datatowrite = filedata.read()
|
|
|
|
with open('pybass_055.zip', 'wb') as f:
|
|
f.write(datatowrite)
|
|
f.close()
|
|
|
|
print "extracting pybass"
|
|
zip_ref = zipfile.ZipFile('pybass_055.zip', 'r')
|
|
zip_ref.extractall()
|
|
zip_ref.close()
|
|
|
|
print "renaming pybass.py"
|
|
if os.path.exists("pybass/__init__.py"): os.remove('pybass/__init__.py')
|
|
os.rename('pybass/pybass.py', 'pybass/__init__.py')
|
|
|
|
arch = platform.uname()[4]
|
|
|
|
BASSZIP = ""
|
|
BASSDLL = ""
|
|
BASSOPUSZIP = ""
|
|
BASSOPUSDLL = ""
|
|
BASSFLACZIP = ""
|
|
BASSFLACDLL = ""
|
|
|
|
if arch not in ["x86", "x86_64", "AMD64"]:
|
|
arch = "x86_64"
|
|
print "Assuming that your system is x86_64..."
|
|
|
|
if platform.system() == "Windows":
|
|
if arch in ["x86_64", "AMD64"]:
|
|
arch = "x64/"
|
|
BASSZIP = "bass24.zip"
|
|
BASSDLL = arch + "bass.dll"
|
|
BASSOPUSZIP = "bassopus24.zip"
|
|
BASSOPUSDLL = arch + "bassopus.dll"
|
|
BASSFLACZIP = "bassflac24.zip"
|
|
BASSFLACDLL = arch + "bassflac.dll"
|
|
elif platform.system() == "Linux":
|
|
BASSZIP = "bass24-linux.zip"
|
|
BASSDLL = "libs/" + arch + "/libbass.so"
|
|
BASSOPUSZIP = "bassopus24-linux.zip"
|
|
BASSOPUSDLL = "libs/" + arch + "/libbassopus.so"
|
|
BASSFLACZIP = "bassflac24-linux.zip"
|
|
BASSFLACDLL = "libs/" + arch + "/libbassflac.so"
|
|
|
|
print "downloading", BASSZIP
|
|
filedata = urllib2.urlopen('http://us.un4seen.com/files/' + BASSZIP)
|
|
datatowrite = filedata.read()
|
|
|
|
with open(BASSZIP, 'wb') as f:
|
|
f.write(datatowrite)
|
|
f.close()
|
|
|
|
print "extracting " + BASSDLL + " from " + BASSZIP
|
|
zip_ref = zipfile.ZipFile(BASSZIP, 'r')
|
|
zip_ref.extract(BASSDLL)
|
|
zip_ref.close()
|
|
|
|
print "downloading", BASSOPUSZIP
|
|
filedata = urllib2.urlopen('http://us.un4seen.com/files/' + BASSOPUSZIP)
|
|
datatowrite = filedata.read()
|
|
|
|
with open(BASSOPUSZIP, 'wb') as f:
|
|
f.write(datatowrite)
|
|
f.close()
|
|
|
|
print "extracting " + BASSOPUSDLL + " from " + BASSOPUSZIP
|
|
zip_ref = zipfile.ZipFile(BASSOPUSZIP, 'r')
|
|
zip_ref.extract(BASSOPUSDLL)
|
|
zip_ref.close()
|
|
|
|
print "downloading", BASSFLACZIP
|
|
filedata = urllib2.urlopen('http://us.un4seen.com/files/' + BASSFLACZIP)
|
|
datatowrite = filedata.read()
|
|
|
|
with open(BASSFLACZIP, 'wb') as f:
|
|
f.write(datatowrite)
|
|
f.close()
|
|
|
|
print "extracting " + BASSFLACDLL + " from " + BASSFLACZIP
|
|
zip_ref = zipfile.ZipFile(BASSFLACZIP, 'r')
|
|
zip_ref.extract(BASSFLACDLL)
|
|
zip_ref.close()
|
|
|
|
if platform.system() == "Windows" and arch == "x64/":
|
|
os.rename(BASSDLL, "bass.dll")
|
|
os.rename(BASSOPUSDLL, "bassopus.dll")
|
|
os.rename(BASSFLACDLL, "bassflac.dll")
|
|
os.rmdir("x64")
|
|
elif platform.system() == "Linux":
|
|
os.rename(BASSDLL, "libbass.so")
|
|
os.rename(BASSOPUSDLL, "libbassopus.so")
|
|
os.rename(BASSFLACDLL, "libbassflac.so")
|
|
os.rmdir("libs/" + arch)
|
|
os.rmdir("libs")
|
|
|
|
os.remove(BASSZIP)
|
|
os.remove(BASSOPUSZIP)
|
|
os.remove(BASSFLACZIP)
|
|
|
|
pip_install("apng", "six", "appdirs", "packaging")
|
|
|
|
try:
|
|
from PIL import Image
|
|
if Image.__version__ != "5.3.0":
|
|
jm = raw_input("Pillow version 5.3.0 is recommended for compatibility with AO2XP; You have version %s\nReplace with version 5.3.0? (Y/N) > " % Image.__version__).lower()
|
|
if jm == "y":
|
|
pip_install("Pillow==5.3.0")
|
|
else:
|
|
print "Pillow 5.3.0 already exists, skipping"
|
|
|
|
except ImportError:
|
|
pip_install("Pillow==5.3.0")
|
|
|
|
pip_install('pyinstaller==3.6')
|
|
pip_install("websocket-client")
|
|
|
|
if platform.system() == "Windows":
|
|
print "downloading pyqt4"
|
|
filedata = requests.get('https://pypi.anaconda.org/ales-erjavec/simple/pyqt4/4.11.4/PyQt4-4.11.4-cp27-none-win32.whl')
|
|
datatowrite = filedata.content
|
|
|
|
with open('PyQt4-4.11.4-cp27-cp27m-win32.whl', 'wb') as f:
|
|
f.write(datatowrite)
|
|
f.close()
|
|
|
|
print "installing pyqt4"
|
|
pip_install('PyQt4-4.11.4-cp27-cp27m-win32.whl')
|
|
raw_input("Press Enter to continue...")
|
|
|
|
elif platform.system() == "Darwin":
|
|
print "installing pyobjc"
|
|
pip_install("pyobjc")
|
|
|
|
try:
|
|
import Tkinter
|
|
print "for Mac OS X, use homebrew or macports to install pyqt4."
|
|
print " brew install cartr/qt4/pyqt"
|
|
print " sudo port install py27-pyqt4"
|
|
except: # mac doesn't have tkinter
|
|
print "for Mac OS X, use homebrew or macports to install tkinter and pyqt4."
|
|
print "Homebrew:"
|
|
print " brew uninstall python"
|
|
print " brew install tk"
|
|
print " brew install python --with-tcl-tk"
|
|
print " brew install cartr/qt4/pyqt"
|
|
print "MacPorts:"
|
|
print " sudo port install py27-tkinter -x11 +quartz"
|
|
print " sudo port install py27-pyqt4"
|
|
|
|
elif platform.system() == "Linux":
|
|
print "you need to install PyQt4 and tkinter on your linux distro after this"
|
|
|
|
print "done"
|