diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index 499352c483..8bbfd58043 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -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,15 +581,20 @@ class Device(DeviceConfig, DevicePlugin): pass while p.poll() is None: time.sleep(0.1) - if p.returncode == 0: - 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): - try: - shutil.rmtree(x) - except: - pass + 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) \ + and not os.listdir(x): + try: + shutil.rmtree(x) + except: + pass def eject(self): diff --git a/upload.py b/upload.py index c0be14aa46..0bbe98e9fa 100644 --- a/upload.py +++ b/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 = '