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):
|
||||
drives = self.find_device_nodes()
|
||||
success = False
|
||||
for drive in drives:
|
||||
if drive:
|
||||
cmd = ['pumount', '-l']
|
||||
@ -580,11 +581,16 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
pass
|
||||
while p.poll() is None:
|
||||
time.sleep(0.1)
|
||||
if p.returncode == 0:
|
||||
success = success or p.returncode == 0
|
||||
try:
|
||||
subprocess.Popen(['sudo', 'eject', drive])
|
||||
except:
|
||||
pass
|
||||
for x in ('_main_prefix', '_card_a_prefix', '_card_b_prefix'):
|
||||
x = getattr(self, x, None)
|
||||
if x is not None:
|
||||
if x.startswith('/media/') and os.path.exists(x):
|
||||
if x.startswith('/media/') and os.path.exists(x) \
|
||||
and not os.listdir(x):
|
||||
try:
|
||||
shutil.rmtree(x)
|
||||
except:
|
||||
|
14
upload.py
14
upload.py
@ -459,7 +459,7 @@ class upload_demo(OptionlessCommand):
|
||||
def run(self):
|
||||
check_call(
|
||||
'''ebook-convert %s/demo.html /tmp/html2lrf.lrf '''
|
||||
'''--title='Demonstration of html2lrf' --author='Kovid Goyal' '''
|
||||
'''--title='Demonstration of html2lrf' --authors='Kovid Goyal' '''
|
||||
'''--header '''
|
||||
'''--serif-family "/usr/share/fonts/corefonts, Times New Roman" '''
|
||||
'''--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(
|
||||
("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):
|
||||
if ext in ('exe', 'dmg'):
|
||||
@ -762,6 +753,7 @@ try:
|
||||
class ChangelogFormatter(blog.LogFormatter):
|
||||
supports_tags = True
|
||||
supports_merge_revisions = False
|
||||
_show_advice = False
|
||||
|
||||
def __init__(self, num_of_versions=20):
|
||||
from calibre.utils.rss_gen import RSS2
|
||||
@ -786,7 +778,7 @@ try:
|
||||
mkup = '<div><ul>%s</ul></div>'
|
||||
self.current_entry.description = mkup%(''.join(
|
||||
self.current_entry.description))
|
||||
if match.group(1) == '0.6.0':
|
||||
if match.group(1) == '0.5.14':
|
||||
self.current_entry.description = \
|
||||
'''<div>See <a href="http://calibre.kovidgoyal.net/new_in_6">New in
|
||||
6</a></div>'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user