From 943f6f4c4bc59ea786f95e1f65473f9f0c57d4a9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 5 Jun 2009 11:45:39 -0700 Subject: [PATCH] Eject for OS X (needs testing) --- installer/osx/freeze.py | 4 ++-- src/calibre/devices/usbms/device.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/installer/osx/freeze.py b/installer/osx/freeze.py index 2471e2867f..28d2bd9aa2 100644 --- a/installer/osx/freeze.py +++ b/installer/osx/freeze.py @@ -19,7 +19,7 @@ from modulegraph.find_modules import find_modules PYTHON = '/Library/Frameworks/Python.framework/Versions/Current/bin/python' class BuildAPP(py2app): - QT_PREFIX = '/Volumes/sw/qt' + QT_PREFIX = '/Users/kovid/qt' LOADER_TEMPLATE = \ r'''#!/usr/bin/env python import os, sys, glob @@ -230,7 +230,7 @@ _check_symlinks_prescript() all_functions = main_functions['console'] + main_functions['gui'] print print 'Adding PoDoFo' - pdf = glob.glob(os.path.expanduser('~/podofo/*.dylib'))[0] + pdf = glob.glob(os.path.expanduser('/Volumes/sw/podofo/*.dylib'))[0] shutil.copyfile(pdf, os.path.join(frameworks_dir, os.path.basename(pdf))) diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index 7ad93b1d6e..f0c54d7051 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -493,9 +493,15 @@ class Device(DeviceConfig, DevicePlugin): def eject_windows(self): pass - + def eject_osx(self): - pass + for x in ('_main_prefix', '_card_a_prefix', '_card_b_prefix'): + x = getattr(self, x, None) + if x is not None: + try: + subprocess.Popen(['diskutil', 'eject', x]) + except: + pass def eject_linux(self): drives = self.find_device_nodes()