mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
version 0.4.34
This commit is contained in:
parent
61956b443c
commit
2537df374e
@ -234,10 +234,7 @@ def post_install():
|
|||||||
|
|
||||||
setup_udev_rules()
|
setup_udev_rules()
|
||||||
setup_completion()
|
setup_completion()
|
||||||
try:
|
setup_desktop_integration()
|
||||||
setup_desktop_integration()
|
|
||||||
except:
|
|
||||||
print >>sys.stderr, 'You do not have the Portland Desktop Utilities installed, skipping installation of desktop integration'
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PyQt4 import Qt
|
from PyQt4 import Qt
|
||||||
@ -288,40 +285,52 @@ MIME = '''\
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def setup_desktop_integration():
|
def setup_desktop_integration():
|
||||||
from PyQt4.QtGui import QApplication, QPixmap
|
|
||||||
from PyQt4.QtCore import Qt
|
|
||||||
from libprs500.gui2 import images_rc
|
|
||||||
from tempfile import mkdtemp
|
|
||||||
|
|
||||||
print 'Setting up desktop integration...'
|
|
||||||
|
|
||||||
app = QApplication([])
|
|
||||||
svg = QPixmap(':/images/mimetypes/lrf.svg').scaled(128, 128, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
|
||||||
gui = QPixmap(':library').scaled(128, 128, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
|
||||||
viewer = QPixmap(':/images/viewer.svg').scaled(128, 128, Qt.KeepAspectRatio, Qt.SmoothTransformation)
|
|
||||||
tdir = mkdtemp()
|
|
||||||
try:
|
try:
|
||||||
os.chdir(tdir)
|
from PyQt4.QtCore import QFile
|
||||||
svg.save(os.path.join(tdir, 'libprs500-lrf.png'), 'PNG')
|
from libprs500.gui2 import images_rc # Load images
|
||||||
gui.save(os.path.join(tdir, 'libprs500-gui.png'), 'PNG')
|
from tempfile import mkdtemp
|
||||||
viewer.save(os.path.join(tdir, 'libprs500-viewer.png'), 'PNG')
|
|
||||||
check_call('xdg-icon-resource install --context mimetypes --size 128 libprs500-lrf.png application-lrf', shell=True)
|
print 'Setting up desktop integration...'
|
||||||
check_call('xdg-icon-resource install --context mimetypes --size 128 libprs500-lrf.png text-lrs', shell=True)
|
|
||||||
check_call('xdg-icon-resource install --size 128 libprs500-gui.png libprs500-gui', shell=True)
|
|
||||||
check_call('xdg-icon-resource install --size 128 libprs500-viewer.png libprs500-viewer', shell=True)
|
tdir = mkdtemp()
|
||||||
f = open('libprs500-lrfviewer.desktop', 'wb')
|
rsvg = 'rsvg --dpi-x 600 --dpi-y 600 -w 128 -h 128 -f png '
|
||||||
f.write(VIEWER)
|
cwd = os.getcwdu()
|
||||||
f.close()
|
try:
|
||||||
f = open('libprs500-gui.desktop', 'wb')
|
os.chdir(tdir)
|
||||||
f.write(GUI)
|
if QFile(':/images/mimetypes/lrf.svg').copy(os.path.join(tdir, 'libprs500-lrf.svg')):
|
||||||
f.close()
|
check_call(rsvg + 'libprs500-lrf.svg libprs500-lrf.png', shell=True)
|
||||||
check_call('xdg-desktop-menu install ./libprs500-gui.desktop ./libprs500-lrfviewer.desktop', shell=True)
|
check_call('xdg-icon-resource install --context mimetypes --size 128 libprs500-lrf.png application-lrf', shell=True)
|
||||||
f = open('libprs500-mimetypes', 'wb')
|
check_call('xdg-icon-resource install --context mimetypes --size 128 libprs500-lrf.png text-lrs', shell=True)
|
||||||
f.write(MIME)
|
else:
|
||||||
f.close()
|
raise Exception('Could not create LRF mimetype icon')
|
||||||
check_call('xdg-mime install libprs500-mimetypes', shell=True)
|
if QFile(':library').copy(os.path.join(tdir, 'libprs500-gui.png')):
|
||||||
finally:
|
check_call('xdg-icon-resource install --size 128 libprs500-gui.png libprs500-gui', shell=True)
|
||||||
shutil.rmtree(tdir)
|
else:
|
||||||
|
raise Exception('Could not creaet GUI icon')
|
||||||
|
if QFile(':/images/viewer.svg').copy(os.path.join(tdir, 'libprs500-viewer.svg')):
|
||||||
|
check_call(rsvg + 'libprs500-viewer.svg libprs500-viewer.png', shell=True)
|
||||||
|
check_call('xdg-icon-resource install --size 128 libprs500-viewer.png libprs500-viewer', shell=True)
|
||||||
|
else:
|
||||||
|
raise Exception('Could not creaet viewer icon')
|
||||||
|
|
||||||
|
f = open('libprs500-lrfviewer.desktop', 'wb')
|
||||||
|
f.write(VIEWER)
|
||||||
|
f.close()
|
||||||
|
f = open('libprs500-gui.desktop', 'wb')
|
||||||
|
f.write(GUI)
|
||||||
|
f.close()
|
||||||
|
check_call('xdg-desktop-menu install ./libprs500-gui.desktop ./libprs500-lrfviewer.desktop', shell=True)
|
||||||
|
f = open('libprs500-mimetypes', 'wb')
|
||||||
|
f.write(MIME)
|
||||||
|
f.close()
|
||||||
|
check_call('xdg-mime install libprs500-mimetypes', shell=True)
|
||||||
|
finally:
|
||||||
|
os.chdir(cwd)
|
||||||
|
shutil.rmtree(tdir)
|
||||||
|
except Exception, err:
|
||||||
|
print >>sys.stderr, 'Could not setup desktop integration. Error:'
|
||||||
|
print err
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
53
upload.py
53
upload.py
@ -13,53 +13,22 @@ TXT2LRF = "src/libprs500/ebooks/lrf/txt/demo"
|
|||||||
check_call = partial(_check_call, shell=True)
|
check_call = partial(_check_call, shell=True)
|
||||||
h = Host(hostType=VIX_SERVICEPROVIDER_VMWARE_WORKSTATION)
|
h = Host(hostType=VIX_SERVICEPROVIDER_VMWARE_WORKSTATION)
|
||||||
|
|
||||||
|
|
||||||
def build_windows():
|
def build_windows():
|
||||||
files = glob.glob('dist/*.exe')
|
from libprs500 import __version__
|
||||||
for file in files:
|
installer = 'dist/libprs500-%s.exe'%__version__
|
||||||
os.unlink(file)
|
if not os.path.exists(installer):
|
||||||
|
raise Exception('You must build the windows installer before running this script')
|
||||||
|
|
||||||
|
return os.path.basename(installer)
|
||||||
|
|
||||||
vm = h.openVM('/mnt/vista/Windows Vista/Windows Vista.vmx')
|
|
||||||
vm.powerOn()
|
|
||||||
if not vm.waitForToolsInGuest():
|
|
||||||
print >>sys.stderr, 'Windows is not booting up'
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vm.loginInGuest('kovid', 'et tu brutus')
|
|
||||||
vm.loginInGuest(VIX_CONSOLE_USER_NAME, '')
|
|
||||||
vm.runProgramInGuest('C:\\Users\kovid\Desktop\libprs500.bat', '')
|
|
||||||
if not glob.glob('dist/*.exe'):
|
|
||||||
raise Exception('Windows build has failed')
|
|
||||||
vm.runProgramInGuest('C:\Windows\system32\shutdown.exe', '/s')
|
|
||||||
return os.path.basename(glob.glob('dist/*.exe')[-1])
|
|
||||||
|
|
||||||
def build_osx():
|
def build_osx():
|
||||||
files = glob.glob('dist/*.dmg')
|
from libprs500 import __version__
|
||||||
for file in files:
|
installer = 'dist/libprs500-%s.dmg'%__version__
|
||||||
os.unlink(file)
|
if not os.path.exists(installer):
|
||||||
if os.path.exists('dist/dmgdone'):
|
raise Exception('You must build the OSX installer before running this script')
|
||||||
os.unlink('dist/dmgdone')
|
|
||||||
|
|
||||||
vm = h.openVM('/mnt/osx/Mac OSX/Mac OSX.vmx')
|
|
||||||
vm.powerOn()
|
|
||||||
c = 25 * 60
|
|
||||||
print 'Waiting (minutes):',
|
|
||||||
while c > 0 and not os.path.exists('dist/dmgdone'):
|
|
||||||
time.sleep(10)
|
|
||||||
c -= 10
|
|
||||||
if c%60==0:
|
|
||||||
print c/60, ',',
|
|
||||||
sys.stdout.flush()
|
|
||||||
print
|
|
||||||
|
|
||||||
if not os.path.exists('dist/dmgdone'):
|
|
||||||
raise Exception('OSX build has failed')
|
|
||||||
vm.powerOff()
|
|
||||||
return os.path.basename(glob.glob('dist/*.dmg')[-1])
|
|
||||||
|
|
||||||
|
return os.path.basename(installer)
|
||||||
|
|
||||||
|
|
||||||
def upload_demo():
|
def upload_demo():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user