liveusb/creator.py | 58 ++++++++++++++++++++++++++-------------------------- liveusb/gui.py | 5 ++-- liveusb/releases.py | 2 - 3 files changed, 33 insertions(+), 32 deletions(-)
New commits: commit 8abe99e9cff41bc6ebcf9b64c1112cb8b7c8d2aa Author: Luke Macken lmacken@redhat.com Date: Tue Feb 5 19:25:37 2013 -0500
Change the arch order (#811)
diff --git a/liveusb/releases.py b/liveusb/releases.py index b483d7b..138d7b9 100644 --- a/liveusb/releases.py +++ b/liveusb/releases.py @@ -3,7 +3,7 @@ from urlgrabber import urlread from urlgrabber.grabber import URLGrabError
FEDORA_RELEASES = 'http://dl.fedoraproject.org/pub/fedora/linux/releases/' -ARCHES = ('i386', 'i686', 'x86_64') +ARCHES = ('x86_64', 'i686', 'i386')
# A backup list of releases, just in case we can't fetch them. fedora_releases = [
commit 3a3aa8c36d472140002b48177c5093cf1c686cd6 Author: Luke Macken lmacken@redhat.com Date: Tue Jan 15 16:51:39 2013 -0500
Support non-ascii mount points (#660603)
diff --git a/liveusb/creator.py b/liveusb/creator.py index 44e33e4..cc2cb45 100755 --- a/liveusb/creator.py +++ b/liveusb/creator.py @@ -454,7 +454,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator): 'fsversion': str(dev.Get(device, 'IdVersion')), 'uuid': str(dev.Get(device, 'IdUuid')), 'device': str(dev.Get(device, 'DeviceFile')), - 'mount': map(str, list(dev.Get(device, 'DeviceMountPaths'))), + 'mount': map(unicode, list(dev.Get(device, 'DeviceMountPaths'))), 'bootable': 'boot' in map(str, list(dev.Get(device, 'PartitionFlags'))), 'parent': None, @@ -537,12 +537,12 @@ class LinuxLiveUSBCreator(LiveUSBCreator): return is_volume
def _add_device(self, dev, parent=None): - mount = str(dev.GetProperty('volume.mount_point')) + mount = unicode(dev.GetProperty('volume.mount_point')) device = str(dev.GetProperty('block.device')) if parent: parent = parent.GetProperty('block.device') self.drives[device] = { - 'label' : str(dev.GetProperty('volume.label')).replace(' ', '_'), + 'label' : unicode(dev.GetProperty('volume.label')).replace(' ', '_'), 'fstype' : str(dev.GetProperty('volume.fstype')), 'fsversion': str(dev.GetProperty('volume.fsversion')), 'uuid' : str(dev.GetProperty('volume.uuid')), @@ -584,7 +584,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator): udi = self.drive['udi'] dev_obj = self.bus.get_object("org.freedesktop.UDisks", udi) dev = dbus.Interface(dev_obj, "org.freedesktop.DBus.Properties") - mounts = map(str, list(dev.Get(udi, 'DeviceMountPaths'))) + mounts = map(unicode, list(dev.Get(udi, 'DeviceMountPaths'))) if not mounts: self.log.error(_('No mount points found after mounting attempt')) else: @@ -717,7 +717,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator): """ Return the number of available bytes on our device """ import statvfs device = device and device or self.dest - stat = os.statvfs(device) + stat = os.statvfs(device.encode('utf-8')) return stat[statvfs.F_BSIZE] * stat[statvfs.F_BAVAIL]
def _get_device(self, udi): @@ -843,7 +843,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator): parent = self.drive.get('parent', self._drive) if parent is None: parent = self._drive - parent = str(parent) + parent = unicode(parent) self.log.debug('Checking the MBR of %s' % parent) drive = open(parent, 'rb') mbr = ''.join(['%02X' % ord(x) for x in drive.read(2)]) @@ -873,7 +873,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator): return mbr == self.get_mbr()
def reset_mbr(self): - parent = str(self.drive.get('parent', self._drive)) + parent = unicode(self.drive.get('parent', self._drive)) if '/dev/loop' not in self.drive: mbr = self._get_mbr_bin() if mbr: @@ -896,7 +896,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator): # Get size of drive #progress.set_max_progress(self.isosize / 1024) checksum = hashlib.sha1() - device_name = str(self.drive['parent']) + device_name = unicode(self.drive['parent']) device = file(device_name, 'rb') bytes = 1024**2 total = 0 diff --git a/liveusb/gui.py b/liveusb/gui.py index eb6af73..745b4e8 100755 --- a/liveusb/gui.py +++ b/liveusb/gui.py @@ -382,9 +382,10 @@ class LiveUSBDialog(QtGui.QDialog, LiveUSBInterface): 2gigs of free space, set the maximum to 2047mb, which is apparently the largest file we can/should store on a vfat partition. """ - if not str(drive): + drive = unicode(drive) + if not drive: return - self._refresh_overlay_slider(str(drive).split()[0]) + self._refresh_overlay_slider(drive.split()[0])
def _refresh_overlay_slider(self, drive=None): """
commit 5f797a329dc86d54ebefd2d09fcca583a880c5ce Author: Luke Macken lmacken@redhat.com Date: Tue Jan 15 16:51:02 2013 -0500
Wrap more of our strings for i18n
diff --git a/liveusb/creator.py b/liveusb/creator.py index bec1ecf..44e33e4 100755 --- a/liveusb/creator.py +++ b/liveusb/creator.py @@ -251,7 +251,7 @@ class LiveUSBCreator(object): self.log.debug('overlaysize = %d' % overlaysize) self.totalsize = overlaysize + self.isosize if self.totalsize > freebytes: - raise LiveUSBError(_("Not enough free space on device." + + raise LiveUSBError(_("Not enough free space on device." + "\n%dMB ISO + %dMB overlay > %dMB free space" % (self.isosize/1024**2, self.overlay, freebytes/1024**2))) @@ -310,7 +310,7 @@ class LiveUSBCreator(object): try: shutil.copyfile(infile, outfile) except Exception, e: - self.log.warning("Unable to copy %s to %s: %s" % (infile, outfile, str(e))) + self.log.warning(_("Unable to copy %s to %s: %s") % (infile, outfile, str(e)))
def delete_liveos(self): """ Delete the existing LiveOS """ @@ -319,14 +319,14 @@ class LiveUSBCreator(object): os.path.join(self.dest + os.path.sep, 'syslinux'), os.path.join(self.dest + os.path.sep, 'isolinux')]: if os.path.exists(path): - self.log.debug("Deleting " + path) + self.log.debug(_("Deleting ") + path) # Python for Windows is unable to delete read-only files, if os.path.isdir(path): for f in os.listdir(path): try: os.chmod(os.path.join(path, f), 0777) except OSError, e: - self.log.debug("Unable to delete %s: %s" % (f, str(e))) + self.log.debug(_("Unable to delete %s: %s") % (f, e)) try: shutil.rmtree(path) except OSError, e: @@ -573,10 +573,10 @@ class LinuxLiveUSBCreator(LiveUSBCreator): except dbus.exceptions.DBusException, e: if e.get_dbus_name() == \ 'org.freedesktop.Hal.Device.Volume.AlreadyMounted': - self.log.debug('Device already mounted') + self.log.debug(_('Device already mounted')) else: - self.log.error('Unknown dbus exception while trying to ' - 'mount device: %s' % str(e)) + self.log.error(_('Unknown dbus exception while trying to ' + 'mount device: %s') % str(e)) except Exception, e: raise LiveUSBError(_("Unable to mount device: %s" % str(e)))
@@ -593,7 +593,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator): self.log.debug("Mounted %s to %s " % (self.drive['device'], self.dest)) else: - self.log.debug("Using existing mount: %s" % self.dest) + self.log.debug(_("Using existing mount: %s") % self.dest)
def unmount_device(self): """ Unmount our device """ @@ -614,8 +614,8 @@ class LinuxLiveUSBCreator(LiveUSBCreator): raise LiveUSBError(_("Unsupported filesystem: %s" % self.fstype)) if self.drive['label'] != self.label: - self.log.info("Setting %s label to %s" % (self.drive['device'], - self.label)) + self.log.info(_("Setting %s label to %s") % (self.drive['device'], + self.label)) try: if self.fstype in ('vfat', 'msdos'): try: @@ -628,7 +628,7 @@ class LinuxLiveUSBCreator(LiveUSBCreator): self.popen('/sbin/e2label %s %s' % (self.drive['device'], self.label)) except LiveUSBError, e: - self.log.error("Unable to change volume label: %s" % str(e)) + self.log.error(_("Unable to change volume label: %s") % e)
def extract_iso(self): """ Extract self.iso to self.dest """ @@ -946,7 +946,7 @@ class WindowsLiveUSBCreator(LiveUSBCreator): try: vol = win32api.GetVolumeInformation(drive) except pywintypes.error, e: - self.log.error('Unable to get GetVolumeInformation(%s): %s' % (drive, str(e))) + self.log.error(_('Unable to get GetVolumeInformation(%s): %s') % (drive, e)) continue self.drives[drive] = { 'label': vol[0], @@ -985,7 +985,7 @@ class WindowsLiveUSBCreator(LiveUSBCreator): self.log.debug("Set %s label to %s" % (self.drive['device'], self.label)) except pywintypes.error, e: - self.log.warning("Unable to SetVolumeLabel: " + str(e)) + self.log.warning(_("Unable to SetVolumeLabel: ") + e)
def get_free_bytes(self, device=None): """ Return the number of free bytes on our selected drive """ @@ -994,7 +994,7 @@ class WindowsLiveUSBCreator(LiveUSBCreator): try: (spc, bps, fc, tc) = win32file.GetDiskFreeSpace(device) except Exception, e: - self.log.error("Problem determining free space: %s" % str(e)) + self.log.error(_("Problem determining free space: %s") % e) return 0 return fc * (spc * bps) # free-clusters * bytes per-cluster
@@ -1008,7 +1008,7 @@ class WindowsLiveUSBCreator(LiveUSBCreator): if delta.seconds: self.mb_per_sec = (self.isosize / delta.seconds) / 1024**2 if self.mb_per_sec: - self.log.info(_("Wrote to device at") + " %d MB/sec" % + self.log.info(_("Wrote to device at") + " %d MB/sec" % self.mb_per_sec)
def install_bootloader(self): @@ -1075,10 +1075,10 @@ class WindowsLiveUSBCreator(LiveUSBCreator): uuid = None else: uuid = uuid[:4] + '-' + uuid[4:] - self.log.debug("Found UUID %s for %s" % (uuid, drive)) + self.log.debug(_("Found UUID %s for %s") % (uuid, drive)) except Exception, e: self.log.exception(e) - self.log.warning("Exception while fetching UUID: %s" % str(e)) + self.log.warning(_("Exception while fetching UUID: %s") % e) return uuid
def _get_device_size(self, drive): @@ -1086,10 +1086,10 @@ class WindowsLiveUSBCreator(LiveUSBCreator): size = None try: size = int(self._get_win32_logicaldisk(drive).Size) - self.log.debug("Max size of %s: %d" % (drive, size)) + self.log.debug(_("Max size of %s: %d") % (drive, size)) except Exception, e: self.log.exception(e) - self.log.warning("Error getting drive size: %s" % str(e)) + self.log.warning(_("Error getting drive size: %s") % e) return size
def popen(self, cmd, **kwargs): @@ -1153,8 +1153,8 @@ class WindowsLiveUSBCreator(LiveUSBCreator): proxies['ftp'] = 'ftp://%s' % server settings.Close() except Exception, e: - self.log.warning('Unable to detect proxy settings: %s' % str(e)) - self.log.debug('Using proxies: %s' % proxies) + self.log.warning(_('Unable to detect proxy settings: %s') % e) + self.log.debug(_('Using proxies: %s') % proxies) return proxies
def verify_iso_md5(self):
liveusb-creator@lists.stg.fedorahosted.org