mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Try to eject unmounted devices in linux. Misc. fixes
This commit is contained in:
parent
8e7d2a2ee8
commit
27a78ef851
@ -571,6 +571,7 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
|
|
||||||
def eject_linux(self):
|
def eject_linux(self):
|
||||||
drives = self.find_device_nodes()
|
drives = self.find_device_nodes()
|
||||||
|
success = False
|
||||||
for drive in drives:
|
for drive in drives:
|
||||||
if drive:
|
if drive:
|
||||||
cmd = ['pumount', '-l']
|
cmd = ['pumount', '-l']
|
||||||
@ -580,15 +581,20 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
pass
|
pass
|
||||||
while p.poll() is None:
|
while p.poll() is None:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
if p.returncode == 0:
|
success = success or p.returncode == 0
|
||||||
for x in ('_main_prefix', '_card_a_prefix', '_card_b_prefix'):
|
try:
|
||||||
x = getattr(self, x, None)
|
subprocess.Popen(['sudo', 'eject', drive])
|
||||||
if x is not None:
|
except:
|
||||||
if x.startswith('/media/') and os.path.exists(x):
|
pass
|
||||||
try:
|
for x in ('_main_prefix', '_card_a_prefix', '_card_b_prefix'):
|
||||||
shutil.rmtree(x)
|
x = getattr(self, x, None)
|
||||||
except:
|
if x is not None:
|
||||||
pass
|
if x.startswith('/media/') and os.path.exists(x) \
|
||||||
|
and not os.listdir(x):
|
||||||
|
try:
|
||||||
|
shutil.rmtree(x)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def eject(self):
|
def eject(self):
|
||||||
|
14
upload.py
14
upload.py
@ -459,7 +459,7 @@ class upload_demo(OptionlessCommand):
|
|||||||
def run(self):
|
def run(self):
|
||||||
check_call(
|
check_call(
|
||||||
'''ebook-convert %s/demo.html /tmp/html2lrf.lrf '''
|
'''ebook-convert %s/demo.html /tmp/html2lrf.lrf '''
|
||||||
'''--title='Demonstration of html2lrf' --author='Kovid Goyal' '''
|
'''--title='Demonstration of html2lrf' --authors='Kovid Goyal' '''
|
||||||
'''--header '''
|
'''--header '''
|
||||||
'''--serif-family "/usr/share/fonts/corefonts, Times New Roman" '''
|
'''--serif-family "/usr/share/fonts/corefonts, Times New Roman" '''
|
||||||
'''--mono-family "/usr/share/fonts/corefonts, Andale Mono" '''
|
'''--mono-family "/usr/share/fonts/corefonts, Andale Mono" '''
|
||||||
@ -471,15 +471,6 @@ class upload_demo(OptionlessCommand):
|
|||||||
|
|
||||||
check_call('scp /tmp/html-demo.zip divok:%s/'%(DOWNLOADS,), shell=True)
|
check_call('scp /tmp/html-demo.zip divok:%s/'%(DOWNLOADS,), shell=True)
|
||||||
|
|
||||||
check_call(
|
|
||||||
("ebook-convert %s/demo.txt /tmp/txt2lrf.lrf -t 'Demonstration of txt2lrf'"
|
|
||||||
"-a 'Kovid Goyal' --header ")%(TXT2LRF,), shell=True)
|
|
||||||
|
|
||||||
check_call('cd src/calibre/ebooks/lrf/txt/demo/ && '
|
|
||||||
'zip -j /tmp/txt-demo.zip * /tmp/txt2lrf.lrf', shell=True)
|
|
||||||
|
|
||||||
check_call('''scp /tmp/txt-demo.zip divok:%s/'''%(DOWNLOADS,), shell=True)
|
|
||||||
|
|
||||||
|
|
||||||
def installer_name(ext):
|
def installer_name(ext):
|
||||||
if ext in ('exe', 'dmg'):
|
if ext in ('exe', 'dmg'):
|
||||||
@ -762,6 +753,7 @@ try:
|
|||||||
class ChangelogFormatter(blog.LogFormatter):
|
class ChangelogFormatter(blog.LogFormatter):
|
||||||
supports_tags = True
|
supports_tags = True
|
||||||
supports_merge_revisions = False
|
supports_merge_revisions = False
|
||||||
|
_show_advice = False
|
||||||
|
|
||||||
def __init__(self, num_of_versions=20):
|
def __init__(self, num_of_versions=20):
|
||||||
from calibre.utils.rss_gen import RSS2
|
from calibre.utils.rss_gen import RSS2
|
||||||
@ -786,7 +778,7 @@ try:
|
|||||||
mkup = '<div><ul>%s</ul></div>'
|
mkup = '<div><ul>%s</ul></div>'
|
||||||
self.current_entry.description = mkup%(''.join(
|
self.current_entry.description = mkup%(''.join(
|
||||||
self.current_entry.description))
|
self.current_entry.description))
|
||||||
if match.group(1) == '0.6.0':
|
if match.group(1) == '0.5.14':
|
||||||
self.current_entry.description = \
|
self.current_entry.description = \
|
||||||
'''<div>See <a href="http://calibre.kovidgoyal.net/new_in_6">New in
|
'''<div>See <a href="http://calibre.kovidgoyal.net/new_in_6">New in
|
||||||
6</a></div>'''
|
6</a></div>'''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user