add mac related stuff
This commit is contained in:
parent
66ffecb268
commit
402a01dddf
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@ dist/
|
||||
*.exe
|
||||
bass*.dll
|
||||
PyQt4-4.11.4-cp27-cp27m-win32.whl
|
||||
*.dylib
|
||||
*.pyc
|
||||
*.zip
|
||||
*.ini
|
25
hardware.py
25
hardware.py
@ -1,7 +1,9 @@
|
||||
import os
|
||||
import platform
|
||||
|
||||
def get_hdid():
|
||||
if os.name == "nt": # what a mess...
|
||||
os = platform.system()
|
||||
|
||||
if os == "Windows": # what a mess...
|
||||
import _winreg
|
||||
registry = getattr(_winreg, "\x48\x4b\x45\x59\x5f\x4c\x4f\x43\x41\x4c\x5f\x4d\x41\x43\x48\x49\x4e\x45")
|
||||
address = "\x53\x4f\x46\x54\x57\x41\x52\x45\x5c\x4d\x69\x63\x72\x6f\x73\x6f\x66\x74\x5c\x43\x72\x79\x70\x74\x6f\x67\x72\x61\x70\x68\x79"
|
||||
@ -11,8 +13,23 @@ def get_hdid():
|
||||
_winreg.CloseKey(key)
|
||||
return value[0]
|
||||
|
||||
elif os.name == "posix":
|
||||
elif os == "Linux":
|
||||
return os.popen("cat /var/lib/dbus/machine-id").read().rstrip()
|
||||
|
||||
elif os == "Darwin": # https://gist.github.com/erikng/46646ff81e55b42e5cfc
|
||||
import objc
|
||||
from Foundation import NSBundle
|
||||
|
||||
IOKit_bundle = NSBundle.bundleWithIdentifier_('com.apple.framework.IOKit')
|
||||
|
||||
functions = [("IOServiceGetMatchingService", b"II@"),
|
||||
("IOServiceMatching", b"@*"),
|
||||
("IORegistryEntryCreateCFProperty", b"@I@@I")
|
||||
]
|
||||
|
||||
objc.loadBundleFunctions(IOKit_bundle, globals(), functions)
|
||||
keyname = "IOPlatformSerialNumber"
|
||||
return IORegistryEntryCreateCFProperty(IOServiceGetMatchingService(0, IOServiceMatching("IOPlatformExpertDevice")), keyname, None, 0)
|
||||
|
||||
else:
|
||||
return "(%s) no u jm" % os.name
|
||||
return "(%s) no u jm" % os
|
||||
|
@ -3,6 +3,7 @@ import zipfile
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import platform
|
||||
|
||||
def pip_install(package):
|
||||
subprocess.call([sys.executable, "-m", "pip", "install", package])
|
||||
@ -28,31 +29,45 @@ print "renaming pybass.py"
|
||||
if os.path.exists("pybass/__init__.py"): os.remove('pybass/__init__.py')
|
||||
os.rename('pybass/pybass.py', 'pybass/__init__.py')
|
||||
|
||||
BASSZIP = "bass24.zip"
|
||||
BASSDLL = "bass.dll"
|
||||
BASSOPUSZIP = "bassopus24.zip"
|
||||
BASSOPUSDLL = "bassopus.dll"
|
||||
if platform.system() == "Darwin":
|
||||
BASSZIP = "bass24-osx.zip"
|
||||
BASSDLL = "libbass.dylib"
|
||||
BASSOPUSZIP = "bassopus24-osx.zip"
|
||||
BASSOPUSDLL = "libbassopus.dylib"
|
||||
elif platform.system() == "Linux":
|
||||
BASSZIP = "bass24-linux.zip"
|
||||
BASSDLL = "libbass.so"
|
||||
BASSOPUSZIP = "bassopus24-linux.zip"
|
||||
BASSOPUSDLL = "libbassopus.so"
|
||||
|
||||
print "downloading bass"
|
||||
filedata = urllib2.urlopen('http://us.un4seen.com/files/bass24.zip')
|
||||
print "downloading", BASSZIP
|
||||
filedata = urllib2.urlopen('http://us.un4seen.com/files/'+BASSZIP)
|
||||
datatowrite = filedata.read()
|
||||
|
||||
with open('bass24.zip', 'wb') as f:
|
||||
with open(BASSZIP, 'wb') as f:
|
||||
f.write(datatowrite)
|
||||
f.close()
|
||||
|
||||
print "extracting bass"
|
||||
zip_ref = zipfile.ZipFile('bass24.zip', 'r')
|
||||
zip_ref.extract('bass.dll')
|
||||
print "extracting "+BASSDLL+" from "+BASSZIP
|
||||
zip_ref = zipfile.ZipFile(BASSZIP, 'r')
|
||||
zip_ref.extract(BASSDLL)
|
||||
zip_ref.close()
|
||||
|
||||
print "downloading bassopus"
|
||||
filedata = urllib2.urlopen('http://us.un4seen.com/files/bassopus24.zip')
|
||||
print "downloading", BASSOPUSZIP
|
||||
filedata = urllib2.urlopen('http://us.un4seen.com/files/'+BASSOPUSZIP)
|
||||
datatowrite = filedata.read()
|
||||
|
||||
with open('bassopus24.zip', 'wb') as f:
|
||||
with open(BASSOPUSZIP, 'wb') as f:
|
||||
f.write(datatowrite)
|
||||
f.close()
|
||||
|
||||
print "extracting bassopus"
|
||||
zip_ref = zipfile.ZipFile('bassopus24.zip', 'r')
|
||||
zip_ref.extract('bassopus.dll')
|
||||
print "extracting "+BASSOPUSDLL+" from "+BASSOPUSZIP
|
||||
zip_ref = zipfile.ZipFile(BASSOPUSZIP, 'r')
|
||||
zip_ref.extract(BASSOPUSDLL)
|
||||
zip_ref.close()
|
||||
|
||||
print "installing apng"
|
||||
@ -72,20 +87,30 @@ except ImportError:
|
||||
print "installing Pillow 5.3.0"
|
||||
pip_install("Pillow==5.3.0")
|
||||
|
||||
|
||||
print "downloading pyqt4"
|
||||
filedata = requests.get('http://raw.githubusercontent.com/dhb52/python-lib/master/PyQt4-4.11.4-cp27-cp27m-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')
|
||||
|
||||
print "installing pyinstaller"
|
||||
pip_install('pyinstaller')
|
||||
|
||||
if platform.system() == "Windows":
|
||||
print "downloading pyqt4"
|
||||
filedata = requests.get('http://raw.githubusercontent.com/dhb52/python-lib/master/PyQt4-4.11.4-cp27-cp27m-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')
|
||||
|
||||
elif platform.system() == "Darwin":
|
||||
print "installing pyobjc"
|
||||
pip_install("pyobjc")
|
||||
|
||||
print "for Mac OS X, use homebrew or macports to install pyqt4:"
|
||||
print " brew install cartr/qt4/pyqt"
|
||||
print " sudo port install py27-pyqt4"
|
||||
|
||||
elif platform.system() == "Linux":
|
||||
print "you need to install PyQt4 on your linux distro after this"
|
||||
|
||||
print "done"
|
||||
|
Loading…
Reference in New Issue
Block a user