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_completion()
|
||||
try:
|
||||
setup_desktop_integration()
|
||||
except:
|
||||
print >>sys.stderr, 'You do not have the Portland Desktop Utilities installed, skipping installation of desktop integration'
|
||||
|
||||
try:
|
||||
from PyQt4 import Qt
|
||||
@ -288,27 +285,35 @@ MIME = '''\
|
||||
'''
|
||||
|
||||
def setup_desktop_integration():
|
||||
from PyQt4.QtGui import QApplication, QPixmap
|
||||
from PyQt4.QtCore import Qt
|
||||
from libprs500.gui2 import images_rc
|
||||
try:
|
||||
from PyQt4.QtCore import QFile
|
||||
from libprs500.gui2 import images_rc # Load images
|
||||
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()
|
||||
rsvg = 'rsvg --dpi-x 600 --dpi-y 600 -w 128 -h 128 -f png '
|
||||
cwd = os.getcwdu()
|
||||
try:
|
||||
os.chdir(tdir)
|
||||
svg.save(os.path.join(tdir, 'libprs500-lrf.png'), 'PNG')
|
||||
gui.save(os.path.join(tdir, 'libprs500-gui.png'), 'PNG')
|
||||
viewer.save(os.path.join(tdir, 'libprs500-viewer.png'), 'PNG')
|
||||
if QFile(':/images/mimetypes/lrf.svg').copy(os.path.join(tdir, 'libprs500-lrf.svg')):
|
||||
check_call(rsvg + 'libprs500-lrf.svg libprs500-lrf.png', shell=True)
|
||||
check_call('xdg-icon-resource install --context mimetypes --size 128 libprs500-lrf.png application-lrf', shell=True)
|
||||
check_call('xdg-icon-resource install --context mimetypes --size 128 libprs500-lrf.png text-lrs', shell=True)
|
||||
else:
|
||||
raise Exception('Could not create LRF mimetype icon')
|
||||
if QFile(':library').copy(os.path.join(tdir, 'libprs500-gui.png')):
|
||||
check_call('xdg-icon-resource install --size 128 libprs500-gui.png libprs500-gui', shell=True)
|
||||
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()
|
||||
@ -321,7 +326,11 @@ def setup_desktop_integration():
|
||||
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__':
|
||||
|
53
upload.py
53
upload.py
@ -13,53 +13,22 @@ TXT2LRF = "src/libprs500/ebooks/lrf/txt/demo"
|
||||
check_call = partial(_check_call, shell=True)
|
||||
h = Host(hostType=VIX_SERVICEPROVIDER_VMWARE_WORKSTATION)
|
||||
|
||||
|
||||
def build_windows():
|
||||
files = glob.glob('dist/*.exe')
|
||||
for file in files:
|
||||
os.unlink(file)
|
||||
from libprs500 import __version__
|
||||
installer = 'dist/libprs500-%s.exe'%__version__
|
||||
if not os.path.exists(installer):
|
||||
raise Exception('You must build the windows installer before running this script')
|
||||
|
||||
|
||||
|
||||
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])
|
||||
return os.path.basename(installer)
|
||||
|
||||
def build_osx():
|
||||
files = glob.glob('dist/*.dmg')
|
||||
for file in files:
|
||||
os.unlink(file)
|
||||
if os.path.exists('dist/dmgdone'):
|
||||
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])
|
||||
from libprs500 import __version__
|
||||
installer = 'dist/libprs500-%s.dmg'%__version__
|
||||
if not os.path.exists(installer):
|
||||
raise Exception('You must build the OSX installer before running this script')
|
||||
|
||||
return os.path.basename(installer)
|
||||
|
||||
|
||||
def upload_demo():
|
||||
|
Loading…
x
Reference in New Issue
Block a user