This commit is contained in:
Kovid Goyal 2013-12-09 21:31:41 +05:30
parent ac0969ae17
commit 2c97eb3d43

View File

@ -89,7 +89,6 @@ class Device(DeviceConfig, DevicePlugin):
STORAGE_CARD_VOLUME_LABEL = ''
STORAGE_CARD2_VOLUME_LABEL = None
EBOOK_DIR_MAIN = ''
EBOOK_DIR_CARD_A = ''
EBOOK_DIR_CARD_B = ''
@ -138,7 +137,8 @@ class Device(DeviceConfig, DevicePlugin):
time.sleep(3)
sectors_per_cluster, bytes_per_sector, free_clusters, total_clusters = \
win32file.GetDiskFreeSpace(prefix)
else: raise
else:
raise
mult = sectors_per_cluster * bytes_per_sector
return total_clusters * mult, free_clusters * mult
@ -254,7 +254,6 @@ class Device(DeviceConfig, DevicePlugin):
pass
return False
for drive, pnp_id in win_pnp_drives().items():
if self.windows_match_device(pnp_id, 'WINDOWS_CARD_A_MEM') and \
not drives.get('carda', False):
@ -320,7 +319,6 @@ class Device(DeviceConfig, DevicePlugin):
raise
time.sleep(2)
def osx_sort_names(self, names):
return names
@ -450,9 +448,11 @@ class Device(DeviceConfig, DevicePlugin):
for i in range(3):
try:
drives = self._osx_bsd_names()
if len(drives) > 1: return drives
if len(drives) > 1:
return drives
except:
if i == 2: raise
if i == 2:
raise
time.sleep(3)
return drives
@ -621,19 +621,22 @@ class Device(DeviceConfig, DevicePlugin):
if mp is None:
raise DeviceError(
_('Unable to mount main memory (Error code: %d)')%ret)
if not mp.endswith('/'): mp += '/'
if not mp.endswith('/'):
mp += '/'
self._linux_mount_map[main] = mp
self._main_prefix = mp
self._linux_main_device_node = main
cards = [(carda, '_card_a_prefix', 'carda'),
(cardb, '_card_b_prefix', 'cardb')]
for card, prefix, typ in cards:
if card is None: continue
if card is None:
continue
mp, ret = mount(card, typ)
if mp is None:
print >>sys.stderr, 'Unable to mount card (Error code: %d)'%ret
else:
if not mp.endswith('/'): mp += '/'
if not mp.endswith('/'):
mp += '/'
setattr(self, prefix, mp)
self._linux_mount_map[card] = mp
@ -679,7 +682,6 @@ class Device(DeviceConfig, DevicePlugin):
self._card_a_prefix = self._card_b_prefix
self._card_b_prefix = None
# ------------------------------------------------------
#
# open for FreeBSD
@ -731,7 +733,8 @@ class Device(DeviceConfig, DevicePlugin):
if vdevif.GetProperty('volume.fsusage') != 'filesystem':
continue
volif = dbus.Interface(bus.get_object('org.freedesktop.Hal', vpath), 'org.freedesktop.Hal.Device.Volume')
pdevif = dbus.Interface(bus.get_object('org.freedesktop.Hal', vdevif.GetProperty('info.parent')), 'org.freedesktop.Hal.Device')
pdevif = dbus.Interface(bus.get_object('org.freedesktop.Hal', vdevif.GetProperty('info.parent')),
'org.freedesktop.Hal.Device')
vol = {'node': pdevif.GetProperty('block.device'),
'dev': vdevif,
'vol': volif,
@ -1054,8 +1057,8 @@ class Device(DeviceConfig, DevicePlugin):
filepath = create_upload_path(mdata, fname, self.save_template(), self.sanitize_callback,
prefix_path=os.path.abspath(path),
maxlen=self.MAX_PATH_LEN,
use_subdirs = self.SUPPORTS_SUB_DIRS and settings.use_subdirs,
news_in_folder = self.NEWS_IN_FOLDER,
use_subdirs=self.SUPPORTS_SUB_DIRS and settings.use_subdirs,
news_in_folder=self.NEWS_IN_FOLDER,
filename_callback=self.filename_callback,
sanitize_path_components=self.sanitize_path_components
)