From 5148cc1578cabb030c52d76213c040b556cdec1a Mon Sep 17 00:00:00 2001 From: persianpros Date: Wed, 14 Apr 2021 00:13:46 +0430 Subject: [PATCH] PEP8 double aggressive E20 and E211 --- NeoBoot/__init__.py | 4 +- NeoBoot/extract.py | 28 ++-- NeoBoot/files/Harddisk.py | 56 ++++---- NeoBoot/files/Task.py | 34 ++--- NeoBoot/files/__init__.py | 4 +- NeoBoot/files/devices.py | 12 +- NeoBoot/files/neoconsole.py | 2 +- NeoBoot/files/stbbranding.py | 14 +- NeoBoot/files/tools.py | 154 +++++++++++----------- NeoBoot/plugin.py | 110 ++++++++-------- NeoBoot/tmpfiles/runpy/arm_run.py | 10 +- NeoBoot/tmpfiles/runpy/duo4k_run.py | 22 ++-- NeoBoot/tmpfiles/runpy/duo4kse_run.py | 22 ++-- NeoBoot/tmpfiles/runpy/mips_run.py | 10 +- NeoBoot/tmpfiles/runpy/vu4k_run.py | 22 ++-- NeoBoot/tmpfiles/runpy/vu_mtd1_run.py | 20 +-- NeoBoot/tmpfiles/runpy/vu_mtd2_run.py | 22 ++-- NeoBoot/tmpfiles/runpy/zero4k_run.py | 20 +-- NeoBoot/ubi_reader_arm/argparse_neo.py | 46 +++---- NeoBoot/ubi_reader_arm/ubi/block/sort.py | 2 +- NeoBoot/ubi_reader_mips/argparse_neo.py | 46 +++---- NeoBoot/ubi_reader_mips/ubi/block/sort.py | 2 +- NeoBoot/unpack.py | 8 +- 23 files changed, 335 insertions(+), 335 deletions(-) diff --git a/NeoBoot/__init__.py b/NeoBoot/__init__.py index d37fbbb..eb23818 100644 --- a/NeoBoot/__init__.py +++ b/NeoBoot/__init__.py @@ -11,14 +11,14 @@ PluginLanguagePath = 'Extensions/NeoBoot/locale' def localeInit(): lang = language.getLanguage()[:2] os.environ['LANGUAGE'] = lang - print ("[NeoBoot] set language to "), lang + print("[NeoBoot] set language to "), lang gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath)) def _(txt): t = gettext.dgettext(PluginLanguageDomain, txt) if t == txt: - print ("[NeoBoot] fallback to default translation for"), txt + print("[NeoBoot] fallback to default translation for"), txt t = gettext.dgettext('enigma2', txt) return t diff --git a/NeoBoot/extract.py b/NeoBoot/extract.py index 453c7cf..404b30b 100644 --- a/NeoBoot/extract.py +++ b/NeoBoot/extract.py @@ -48,7 +48,7 @@ def getBoxVuModel(): f.close() return vumodel -def getCPUtype() : +def getCPUtype(): cpu='UNKNOWN' if os.path.exists('/proc/cpuinfo'): with open('/proc/cpuinfo', 'r') as f: @@ -429,7 +429,7 @@ def NEOBootMainEx(source, target, stopenigma, CopyFiles, CopyKernel, TvList, Lan cmd = 'chmod 0755 %s/ImageBoot/%s/etc/init.d/rc.local' % (media, target) rc = os.system(cmd) - if not os.path.exists('%s/ImageBoot/%s/etc/init.d/rc.local' % (media, target)) and not os.path.exists('%s/ImageBoot/%s/etc/rc.local' % (media, target)) : + if not os.path.exists('%s/ImageBoot/%s/etc/init.d/rc.local' % (media, target)) and not os.path.exists('%s/ImageBoot/%s/etc/rc.local' % (media, target)): if os.path.exists('%s/ImageBoot/%s/etc/init.d' % (media, target)): # cmd = 'ln -s %sImageBoot/%s/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/userscript.sh %sImageBoot/%s/etc/rcS.d/S99neo.local' % (media, # target, @@ -656,7 +656,7 @@ def NEOBootMainEx(source, target, stopenigma, CopyFiles, CopyKernel, TvList, Lan if '.tar.xz' not in source and not os.path.exists('' + getNeoLocation() + '/ImageBoot/%s/etc/issue' % target): os.system('echo ""; echo "No system installed! The reason for the installation error may be badly packed image files or it is not a system for your model."') os.system('echo "The installed system may not start. Check the correctness of the installed image directory!!!"') - os.system('rm -r ' + getNeoLocation() + '/ImageBoot/%s' % target ) + os.system('rm -r ' + getNeoLocation() + '/ImageBoot/%s' % target) if os.path.exists('' + getNeoLocation() + 'ubi'): os.system('rm -r ' + getNeoLocation() + 'ubi') @@ -744,7 +744,7 @@ def RemoveUnpackDirs(): rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/dm920 ') elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/dreamtwo '): rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/dreamtwo ') - elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/multibox') or os.path.exists('' + getNeoLocation() + 'ImagesUpload/multiboxse') : + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/multibox') or os.path.exists('' + getNeoLocation() + 'ImagesUpload/multiboxse'): rc = os.system('mv ' + getNeoLocation() + 'ImagesUpload/multibox ' + getNeoLocation() + 'ImagesUpload/multibox; rm -r ' + getNeoLocation() + 'ImagesUpload/multibox') elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/octagon/sf8008'): rc = os.system('mv ' + getNeoLocation() + 'ImagesUpload/usb_update.bin ' + getNeoLocation() + 'ImagesUpload/octagon; rm -r ' + getNeoLocation() + 'ImagesUpload/octagon') @@ -798,11 +798,11 @@ def RemoveUnpackDirs(): rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/gigablue') elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/rootfs.tar.gz'): rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.gz') - elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/rootfs.tar.xz') : + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/rootfs.tar.xz'): rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.xz') - elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/rootfs.tar.bz2') : + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/rootfs.tar.bz2'): rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.bz2') - elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/et10000') : + elif os.path.exists('' + getNeoLocation() + 'ImagesUpload/et10000'): rc = os.system('rm -r ' + getNeoLocation() + 'ImagesUpload/et10000') @@ -1010,7 +1010,7 @@ def NEOBootExtract(source, target, ZipDelete): #Instalacja image nandsim os.system('echo "Instalacja - nandsim w toku..."') - rc = os.system('insmod /lib/modules/' + getKernelVersion() + '/kernel/drivers/mtd/nand/nandsim.ko cache_file=' + getNeoLocation() + 'image_cache first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15;sleep 5' )#% getKernelVersion()) + rc = os.system('insmod /lib/modules/' + getKernelVersion() + '/kernel/drivers/mtd/nand/nandsim.ko cache_file=' + getNeoLocation() + 'image_cache first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15;sleep 5')#% getKernelVersion()) cmd = 'dd if=%s of=/dev/mtdblock%s bs=2048' % (rootfname, mtd) rc = os.system(cmd) cmd = 'ubiattach /dev/ubi_ctrl -m %s -O 2048' % mtd @@ -1234,7 +1234,7 @@ def NEOBootExtract(source, target, ZipDelete): os.chdir('h9') os.system('mv -f rootfs.ubi rootfs.bin') os.system('echo "Instalacja - ubi_reader w toku..."') - print ("[NeoBoot] Extracting UBIFS image and moving extracted image to our target") + print("[NeoBoot] Extracting UBIFS image and moving extracted image to our target") cmd = 'chmod 777 ' + extensions_path + 'NeoBoot/ubi_reader/ubi_extract_files.py' rc = os.system(cmd) cmd = 'python ' + extensions_path + 'NeoBoot/ubi_reader/ubi_extract_files.py rootfs.bin -o ' + getNeoLocation() + 'ubi' @@ -1252,7 +1252,7 @@ def NEOBootExtract(source, target, ZipDelete): if os.path.exists('' + getNeoLocation() + 'ImagesUpload/axas/axashistwin'): os.chdir('axashistwin') os.system('echo "Instalacja - ubi_reader w toku..."') - print ("[NeoBoot] Extracting UBIFS image and moving extracted image to our target") + print("[NeoBoot] Extracting UBIFS image and moving extracted image to our target") cmd = 'chmod 777 ' + extensions_path + 'NeoBoot/ubi_reader/ubi_extract_files.py' rc = os.system(cmd) cmd = 'python ' + extensions_path + 'NeoBoot/ubi_reader/ubi_extract_files.py rootfs.bin -o ' + getNeoLocation() + 'ubi' @@ -1269,7 +1269,7 @@ def NEOBootExtract(source, target, ZipDelete): os.chdir('et10000') os.system('mv -f rootfs.bin rootfs.bin') os.system('echo "Instalacja - ubi_reader w toku..."') - print ("[NeoBoot] Extracting UBIFS image and moving extracted image to our target") + print("[NeoBoot] Extracting UBIFS image and moving extracted image to our target") cmd = 'chmod 777 ' + extensions_path + 'NeoBoot/ubi_reader/ubi_extract_files.py' rc = os.system(cmd) cmd = 'python ' + extensions_path + 'NeoBoot/ubi_reader/ubi_extract_files.py rootfs.bin -o ' + getNeoLocation() + 'ubi' @@ -1495,11 +1495,11 @@ def NEOBootExtract(source, target, ZipDelete): os.system('cp -af ' + getNeoLocation() + 'ImagesUpload/' + source + '.mb ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.gz') cmd = 'chmod 777 ' + getNeoLocation() + 'ImagesUpload/*.tar.gz; tar -xzvf ' + getNeoLocation() + 'ImagesUpload/*.tar.gz -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' rc = os.system(cmd) - elif '.gz' in sourcefile4 : + elif '.gz' in sourcefile4: os.system('cp -af ' + getNeoLocation() + 'ImagesUpload/*.tar.gz ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.gz') cmd = '/bin/tar -xzvf ' + getNeoLocation() + 'ImagesUpload/rootfs.tar.gz -C ' + getNeoLocation() + 'ImageBoot/' + target + ' > /dev/null 2>&1' rc = os.system(cmd) - if '.gz' in sourcefile4 : + if '.gz' in sourcefile4: cmd = 'rm -rf ' + getNeoLocation() + 'ImagesUpload/*.gz ' ' > /dev/null 2>&1' rc = os.system(cmd) cmd = 'rm -f ' + getNeoLocation() + 'ImagesUpload/*.jpg ' ' > /dev/null 2>&1' @@ -1508,7 +1508,7 @@ def NEOBootExtract(source, target, ZipDelete): os.chdir('ImagesUpload') os.system('mv -f rootfs.bin rootfs.bin') os.system('echo "Instalacja - ubi_reader w toku..."') - print ("[NeoBoot] Extracting UBIFS image and moving extracted image to our target") + print("[NeoBoot] Extracting UBIFS image and moving extracted image to our target") cmd = 'chmod 777 ' + extensions_path + 'NeoBoot/ubi_reader/ubi_extract_files.py' rc = os.system(cmd) cmd = 'python ' + extensions_path + 'NeoBoot/ubi_reader/ubi_extract_files.py rootfs.bin -o ' + getNeoLocation() + 'ubi' diff --git a/NeoBoot/files/Harddisk.py b/NeoBoot/files/Harddisk.py index 5c55aad..5ae7967 100644 --- a/NeoBoot/files/Harddisk.py +++ b/NeoBoot/files/Harddisk.py @@ -33,10 +33,10 @@ def getProcMounts(): try: mounts = open('/proc/mounts', 'r') except IOError as ex: - print (("[Harddisk] Failed to open /proc/mounts"), ex ) + print(("[Harddisk] Failed to open /proc/mounts"), ex) return [] - result = [ line.strip().split(' ') for line in mounts ] + result = [line.strip().split(' ') for line in mounts] for item in result: item[1] = item[1].replace('\\040', ' ') @@ -44,7 +44,7 @@ def getProcMounts(): def getNonNetworkMediaMounts(): - return [ x[1] for x in getProcMounts() if x[1].startswith('/media/') and not x[0].startswith('//') ] + return [x[1] for x in getProcMounts() if x[1].startswith('/media/') and not x[0].startswith('//')] def isFileSystemSupported(filesystem): @@ -55,7 +55,7 @@ def isFileSystemSupported(filesystem): return False except Exception as ex: - print (("[Harddisk] Failed to read /proc/filesystems:'"), ex ) + print(("[Harddisk] Failed to read /proc/filesystems:'"), ex) def findMountPoint(path): @@ -78,7 +78,7 @@ class Harddisk(): elif os.access('/dev/.devfsd', 0): self.type = DEVTYPE_DEVFS else: - print ("[Harddisk] Unable to determine structure of /dev") + print("[Harddisk] Unable to determine structure of /dev") self.type = -1 self.card = False self.max_idle_time = 0 @@ -122,7 +122,7 @@ class Harddisk(): break self.card = self.device[:2] == 'hd' and 'host0' not in self.dev_path - print ("[Harddisk] new device"), self.device, '->', self.dev_path, '->', self.disk_path + print("[Harddisk] new device"), self.device, '->', self.dev_path, '->', self.disk_path if not removable and not self.card: self.startIdle() return @@ -200,7 +200,7 @@ class Harddisk(): return readFile(self.sysfsPath('device/name')) raise (Exception, ("[Harddisk] no hdX or sdX or mmcX")) except Exception as e: - print ("[Harddisk] Failed to get model:"), e + print("[Harddisk] Failed to get model:"), e return '-?-' def free(self): @@ -266,7 +266,7 @@ class Harddisk(): return 0 else: cmd = 'umount ' + dev - print ("[Harddisk]"), cmd + print("[Harddisk]"), cmd res = os.system(cmd) return res >> 8 @@ -294,7 +294,7 @@ class Harddisk(): parts = line.strip().split(' ') fspath = os.path.realpath(parts[0]) if fspath == dev: - print ("[Harddisk] mounting:"), fspath + print("[Harddisk] mounting:"), fspath cmd = 'mount -t auto ' + fspath res = os.system(cmd) return res >> 8 @@ -329,7 +329,7 @@ class Harddisk(): def createInitializeJob(self): job = Task.Job(_('Initializing storage device...')) size = self.diskSize() - print ("[HD] size: %s MB") % size + print("[HD] size: %s MB") % size task = UnmountTask(job, self) task = Task.PythonTask(job, _('Removing partition table')) task.work = self.killPartitionTable @@ -340,7 +340,7 @@ class Harddisk(): task.args.append('-z') task.args.append(self.disk_path) task = Task.ConditionTask(job, _('Waiting for partition'), timeoutCount=20) - task.check = lambda : not os.path.exists(self.partitionPath('1')) + task.check = lambda: not os.path.exists(self.partitionPath('1')) task.weighting = 1 if os.path.exists('/usr/sbin/parted'): use_parted = True @@ -377,12 +377,12 @@ class Harddisk(): task.args.append('-uS') task.args.append(self.disk_path) if size > 128000: - print ("[HD] Detected >128GB disk, using 4k alignment") + print("[HD] Detected >128GB disk, using 4k alignment") task.initial_input = '8,,L\n;0,0\n;0,0\n;0,0\ny\n' else: task.initial_input = ',,L\n;\n;\n;\ny\n' task = Task.ConditionTask(job, _('Waiting for partition')) - task.check = lambda : os.path.exists(self.partitionPath('1')) + task.check = lambda: os.path.exists(self.partitionPath('1')) task.weighting = 1 task = MkfsTask(job, _('Creating filesystem')) big_o_options = ['dir_index'] @@ -623,7 +623,7 @@ class HarddiskManager(): ('/media/usb1', _('USB1 stick')), ('/media/usb2', _('USB2 stick')), ('/', _('Internal flash'))) - known = set([ os.path.normpath(a.mountpoint) for a in self.partitions if a.mountpoint ]) + known = set([os.path.normpath(a.mountpoint) for a in self.partitions if a.mountpoint]) for m, d in p: if m not in known and os.path.ismount(m): self.partitions.append(Partition(mountpoint=m, description=d)) @@ -684,7 +684,7 @@ class HarddiskManager(): medium_found) def enumerateBlockDevices(self): - print ("[Harddisk] enumerating block devices...") + print("[Harddisk] enumerating block devices...") for blockdev in os.listdir('/sys/block'): error, blacklisted, removable, is_cdrom, partitions, medium_found = self.addHotplugPartition(blockdev) if not error and not blacklisted and medium_found: @@ -718,7 +718,7 @@ class HarddiskManager(): physdev = os.path.realpath('/sys/block/' + dev + '/device')[4:] except OSError: physdev = dev - print (("couldn't determine blockdev physdev for device"), device) + print(("couldn't determine blockdev physdev for device"), device) error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device) if not blacklisted and medium_found: @@ -746,7 +746,7 @@ class HarddiskManager(): physdev = os.path.realpath('/sys/block/' + dev + '/device')[4:] except OSError: physdev = dev - print (("couldn't determine blockdev physdev for device"), device ) + print(("couldn't determine blockdev physdev for device"), device) error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device) if not blacklisted and medium_found: @@ -799,8 +799,8 @@ class HarddiskManager(): def getMountedPartitions(self, onlyhotplug=False, mounts=None): if mounts is None: mounts = getProcMounts() - parts = [ x for x in self.partitions if (x.is_hotplug or not onlyhotplug) and x.mounted(mounts) ] - devs = set([ x.device for x in parts ]) + parts = [x for x in self.partitions if (x.is_hotplug or not onlyhotplug) and x.mounted(mounts)] + devs = set([x.device for x in parts]) for devname in devs.copy(): if not devname: continue @@ -808,7 +808,7 @@ class HarddiskManager(): if part and dev in devs: devs.remove(dev) - return [ x for x in parts if not x.device or x.device in devs ] + return [x for x in parts if not x.device or x.device in devs] def splitDeviceName(self, devname): dev = devname[:3] @@ -825,7 +825,7 @@ class HarddiskManager(): try: description = readFile('/sys' + phys + '/model') except IOError as s: - print (("couldn't read model: "), s) + print(("couldn't read model: "), s) if part and part != 1: description += _(' (Partition %d)') % part @@ -854,7 +854,7 @@ class HarddiskManager(): ioctl(cd.fileno(), ioctl_flag, speed) cd.close() except Exception as ex: - print ("[Harddisk] Failed to set %s speed to %s") % (device, speed), ex + print("[Harddisk] Failed to set %s speed to %s") % (device, speed), ex class UnmountTask(Task.LoggingTask): @@ -869,7 +869,7 @@ class UnmountTask(Task.LoggingTask): dev = self.hdd.disk_path.split('/')[-1] open('/dev/nomount.%s' % dev, 'wb').close() except Exception as e: - print ("ERROR: Failed to create /dev/nomount file:"), e + print("ERROR: Failed to create /dev/nomount file:"), e self.setTool('umount') self.args.append('-f') @@ -879,7 +879,7 @@ class UnmountTask(Task.LoggingTask): self.mountpoints.append(dev) if not self.mountpoints: - print ("UnmountTask: No mountpoints found?") + print("UnmountTask: No mountpoints found?") self.cmd = 'true' self.args = [self.cmd] @@ -888,7 +888,7 @@ class UnmountTask(Task.LoggingTask): try: os.rmdir(path) except Exception as ex: - print ("Failed to remove path '%s':") % path, ex + print("Failed to remove path '%s':") % path, ex class MountTask(Task.LoggingTask): @@ -902,7 +902,7 @@ class MountTask(Task.LoggingTask): dev = self.hdd.disk_path.split('/')[-1] os.unlink('/dev/nomount.%s' % dev) except Exception as e: - print ("ERROR: Failed to remove /dev/nomount file:"), e + print("ERROR: Failed to remove /dev/nomount file:"), e if self.hdd.mount_device is None: dev = self.hdd.partitionPath('1') @@ -932,7 +932,7 @@ class MkfsTask(Task.LoggingTask): return def processOutput(self, data): - print ("[Mkfs]"), data + print("[Mkfs]"), data if 'Writing inode tables:' in data: self.fsck_state = 'inode' elif 'Creating journal' in data: @@ -948,7 +948,7 @@ class MkfsTask(Task.LoggingTask): d[1] = d[1].split('\x08', 1)[0] self.setProgress(80 * int(d[0]) / int(d[1])) except Exception as e: - print ("[Mkfs] E:"), e + print("[Mkfs] E:"), e return self.log.append(data) diff --git a/NeoBoot/files/Task.py b/NeoBoot/files/Task.py index 2a8b21f..07b5a4d 100644 --- a/NeoBoot/files/Task.py +++ b/NeoBoot/files/Task.py @@ -32,7 +32,7 @@ class Job(object): if self.current_task == len(self.tasks): return self.end t = self.tasks[self.current_task] - jobprogress = t.weighting * t.progress / float(t.end) + sum([ task.weighting for task in self.tasks[:self.current_task] ]) + jobprogress = t.weighting * t.progress / float(t.end) + sum([task.weighting for task in self.tasks[:self.current_task]]) return int(jobprogress * self.weightScale) progress = property(getProgress) @@ -59,7 +59,7 @@ class Job(object): self.status = self.IN_PROGRESS self.state_changed() self.runNext() - sumTaskWeightings = sum([ t.weighting for t in self.tasks ]) or 1 + sumTaskWeightings = sum([t.weighting for t in self.tasks]) or 1 self.weightScale = self.end / float(sumTaskWeightings) def runNext(self): @@ -70,7 +70,7 @@ class Job(object): self.callback(self, None, []) self.callback = None else: - print ("still waiting for %d resident task(s) %s to finish") % (len(self.resident_tasks), str(self.resident_tasks)) + print("still waiting for %d resident task(s) %s to finish") % (len(self.resident_tasks), str(self.resident_tasks)) else: self.tasks[self.current_task].run(self.taskCallback) self.state_changed() @@ -81,18 +81,18 @@ class Job(object): if stay_resident: if cb_idx not in self.resident_tasks: self.resident_tasks.append(self.current_task) - print ("task going resident:"), task + print("task going resident:"), task else: - print ("task keeps staying resident:"), task + print("task keeps staying resident:"), task return if len(res): - print (">>> Error:"), res + print(">>> Error:"), res self.status = self.FAILED self.state_changed() self.callback(self, task, res) if cb_idx != self.current_task: if cb_idx in self.resident_tasks: - print ("resident task finished:"), task + print("resident task finished:"), task self.resident_tasks.remove(cb_idx) if res == []: self.state_changed() @@ -176,9 +176,9 @@ class Task(object): if self.cwd is not None: self.container.setCWD(self.cwd) if not self.cmd and self.cmdline: - print ("execute:"), self.container.execute(self.cmdline), self.cmdline + print("execute:"), self.container.execute(self.cmdline), self.cmdline else: - print ("execute:"), self.container.execute(self.cmd, *self.args), ' '.join(self.args) + print("execute:"), self.container.execute(self.cmd, *self.args), ' '.join(self.args) if self.initial_input: self.writeInput(self.initial_input) return @@ -187,7 +187,7 @@ class Task(object): def run(self, callback): failed_preconditions = self.checkPreconditions(True) + self.checkPreconditions(False) if failed_preconditions: - print ("[Task] preconditions failed") + print("[Task] preconditions failed") callback(self, failed_preconditions) return self.callback = callback @@ -195,7 +195,7 @@ class Task(object): self.prepare() self._run() except Exception as ex: - print ("[Task] exception:"), ex + print("[Task] exception:"), ex self.postconditions = [FailedPostcondition(ex)] self.finish() @@ -221,7 +221,7 @@ class Task(object): self.output_line = self.output_line[i + 1:] def processOutputLine(self, line): - print ("[Task %s]") % self.name, line[:-1] + print("[Task %s]") % self.name, line[:-1] def processFinished(self, returncode): self.returncode = returncode @@ -276,7 +276,7 @@ class LoggingTask(Task): self.log = [] def processOutput(self, data): - print ("[%s]") % self.name, data, + print("[%s]") % self.name, data, self.log.append(data) @@ -388,7 +388,7 @@ class JobManager: return False def jobDone(self, job, task, problems): - print ("job"), job, ("completed with"), problems, ("in"), task + print("job"), job, ("completed with"), problems, ("in"), task if problems: if not job.onFail(job, task, problems): self.errorCB(False) @@ -408,10 +408,10 @@ class JobManager: def errorCB(self, answer): if answer: - print ("retrying job") + print("retrying job") self.active_job.retry() else: - print ("not retrying job.") + print("not retrying job.") self.failed_jobs.append(self.active_job) self.active_job = None self.kick() @@ -463,7 +463,7 @@ class ToolExistsPrecondition(Condition): import os if task.cmd[0] == '/': self.realpath = task.cmd - print ("[Task.py][ToolExistsPrecondition] WARNING: usage of absolute paths for tasks should be avoided!") + print("[Task.py][ToolExistsPrecondition] WARNING: usage of absolute paths for tasks should be avoided!") return os.access(self.realpath, os.X_OK) self.realpath = task.cmd path = os.environ.get('PATH', '').split(os.pathsep) diff --git a/NeoBoot/files/__init__.py b/NeoBoot/files/__init__.py index d37fbbb..eb23818 100644 --- a/NeoBoot/files/__init__.py +++ b/NeoBoot/files/__init__.py @@ -11,14 +11,14 @@ PluginLanguagePath = 'Extensions/NeoBoot/locale' def localeInit(): lang = language.getLanguage()[:2] os.environ['LANGUAGE'] = lang - print ("[NeoBoot] set language to "), lang + print("[NeoBoot] set language to "), lang gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath)) def _(txt): t = gettext.dgettext(PluginLanguageDomain, txt) if t == txt: - print ("[NeoBoot] fallback to default translation for"), txt + print("[NeoBoot] fallback to default translation for"), txt t = gettext.dgettext('enigma2', txt) return t diff --git a/NeoBoot/files/devices.py b/NeoBoot/files/devices.py index 5c6bb69..4f27295 100644 --- a/NeoBoot/files/devices.py +++ b/NeoBoot/files/devices.py @@ -282,11 +282,11 @@ class ManagerDevice(Screen): self.device_uuid = 'UUID=' + result.split('UUID=')[1].split(' ')[0].replace('"', '') if not path.exists(self.mountp): mkdir(self.mountp, 493) - file('/etc/fstab.tmp', 'w').writelines([ l for l in file('/etc/fstab').readlines() if '/media/hdd' not in l ]) + file('/etc/fstab.tmp', 'w').writelines([l for l in file('/etc/fstab').readlines() if '/media/hdd' not in l]) rename('/etc/fstab.tmp', '/etc/fstab') - file('/etc/fstab.tmp', 'w').writelines([ l for l in file('/etc/fstab').readlines() if self.device not in l ]) + file('/etc/fstab.tmp', 'w').writelines([l for l in file('/etc/fstab').readlines() if self.device not in l]) rename('/etc/fstab.tmp', '/etc/fstab') - file('/etc/fstab.tmp', 'w').writelines([ l for l in file('/etc/fstab').readlines() if self.device_uuid not in l ]) + file('/etc/fstab.tmp', 'w').writelines([l for l in file('/etc/fstab').readlines() if self.device_uuid not in l]) rename('/etc/fstab.tmp', '/etc/fstab') out = open('/etc/fstab', 'a') line = self.device_uuid + '\t/media/hdd\tauto\tdefaults\t0 0\n' @@ -463,7 +463,7 @@ class DevicesConf(Screen, ConfigListScreen): self.close() def add_fstab(self, result=None, retval=None, extra_args=None): - print ("[MountManager] RESULT:"), result + print("[MountManager] RESULT:"), result if result: self.device = extra_args[0] self.mountp = extra_args[1] @@ -477,9 +477,9 @@ class DevicesConf(Screen, ConfigListScreen): self.device_type = 'ntfs' if not path.exists(self.mountp): mkdir(self.mountp, 493) - file('/etc/fstab.tmp', 'w').writelines([ l for l in file('/etc/fstab').readlines() if self.device not in l ]) + file('/etc/fstab.tmp', 'w').writelines([l for l in file('/etc/fstab').readlines() if self.device not in l]) rename('/etc/fstab.tmp', '/etc/fstab') - file('/etc/fstab.tmp', 'w').writelines([ l for l in file('/etc/fstab').readlines() if self.device_uuid not in l ]) + file('/etc/fstab.tmp', 'w').writelines([l for l in file('/etc/fstab').readlines() if self.device_uuid not in l]) rename('/etc/fstab.tmp', '/etc/fstab') out = open('/etc/fstab', 'a') line = self.device_uuid + '\t' + self.mountp + '\t' + self.device_type + '\tdefaults\t0 0\n' diff --git a/NeoBoot/files/neoconsole.py b/NeoBoot/files/neoconsole.py index fb8a9c4..f63ce93 100644 --- a/NeoBoot/files/neoconsole.py +++ b/NeoBoot/files/neoconsole.py @@ -59,7 +59,7 @@ class Console(Screen): def startRun(self): self['text'].setText(_('Execution progress:') + '\n\n') self['summary_description'].setText(_('Execution progress:')) - print ("[Console] executing in run"), self.run, (" the command:"), self.cmdlist[self.run] + print("[Console] executing in run"), self.run, (" the command:"), self.cmdlist[self.run] if self.doExec(self.cmdlist[self.run]): self.runFinished(-1) diff --git a/NeoBoot/files/stbbranding.py b/NeoBoot/files/stbbranding.py index af7a146..4a1fd71 100644 --- a/NeoBoot/files/stbbranding.py +++ b/NeoBoot/files/stbbranding.py @@ -43,7 +43,7 @@ def clearMemory(): f.close() def LogCrashGS(line): - log_file = open('%sImageBoot/neoboot.log' % getNeoLocation() , 'a') + log_file = open('%sImageBoot/neoboot.log' % getNeoLocation(), 'a') log_file.write(line) log_file.close() @@ -84,7 +84,7 @@ def getSupportedTuners(): def getFreespace(dev): statdev = os.statvfs(dev) space = statdev.f_bavail * statdev.f_frsize / 1024 - print ("[NeoBoot] Free space on %s = %i kilobytes") % (dev, space) + print("[NeoBoot] Free space on %s = %i kilobytes") % (dev, space) return space #check install @@ -393,8 +393,8 @@ def getCPUSoCModel(): #zwraca wybrane image w neoboot do uruchomienia def getImageNeoBoot(): imagefile='UNKNOWN' - if os.path.exists('%sImageBoot/.neonextboot' % getNeoLocation() ): - with open('%sImageBoot/.neonextboot' % getNeoLocation() , 'r') as f: + if os.path.exists('%sImageBoot/.neonextboot' % getNeoLocation()): + with open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r') as f: imagefile = f.readline().strip() f.close() return imagefile @@ -467,8 +467,8 @@ def runCMDS(cmdsList): def getImageDistroN(): image='Internal storage' - if fileExists('/.multinfo') and fileExists ('%sImageBoot/.imagedistro' % getNeoLocation() ): - with open('%sImageBoot/.imagedistro' % getNeoLocation() , 'r') as f: + if fileExists('/.multinfo') and fileExists('%sImageBoot/.imagedistro' % getNeoLocation()): + with open('%sImageBoot/.imagedistro' % getNeoLocation(), 'r') as f: image = f.readline().strip() f.close() @@ -498,7 +498,7 @@ def getImageDistroN(): from boxbranding import getImageDistro image = getImageDistro() - elif fileExists('/media/InternalFlash/etc/issue.net') and fileExists('/.multinfo') and not fileExists('%sImageBoot/.imagedistro' % getNeoLocation() ): + elif fileExists('/media/InternalFlash/etc/issue.net') and fileExists('/.multinfo') and not fileExists('%sImageBoot/.imagedistro' % getNeoLocation()): obraz = open('/media/InternalFlash/etc/issue.net', 'r').readlines() imagetype = obraz[0][:-3] image = imagetype diff --git a/NeoBoot/files/tools.py b/NeoBoot/files/tools.py index dffc8ae..814f8fe 100644 --- a/NeoBoot/files/tools.py +++ b/NeoBoot/files/tools.py @@ -142,93 +142,93 @@ class MBTools(Screen): mypixmap = '' +LinkNeoBoot+ '/images/ok.png' png = LoadPixmap(mypixmap) - res = (_ ('Make a copy of the image from NeoBoot'), png, 0) - self.list.append (res) - self ['list']. list = self.list + res = (_('Make a copy of the image from NeoBoot'), png, 0) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Restore a copy of the image to NeoBoot'), png, 1) - self.list.append (res) - self ['list']. list = self.list + res = (_('Restore a copy of the image to NeoBoot'), png, 1) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Device manager'), png, 2) - self.list.append (res) - self ['list']. list = self.list + res = (_('Device manager'), png, 2) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Delete image ZIP from the ImagesUpload directory'), png, 3) - self.list.append (res) - self ['list']. list = self.list + res = (_('Delete image ZIP from the ImagesUpload directory'), png, 3) + self.list.append(res) + self['list']. list = self.list - res = (_ ('NeoBoot Backup'), png, 4) - self.list.append (res) - self ['list']. list = self.list + res = (_('NeoBoot Backup'), png, 4) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Restore neoboot backup'), png, 5) - self.list.append (res) - self ['list']. list = self.list + res = (_('Restore neoboot backup'), png, 5) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Uninstall NeoBoot'), png, 6) - self.list.append (res) - self ['list']. list = self.list + res = (_('Uninstall NeoBoot'), png, 6) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Update NeoBoot on all images.'), png, 7) - self.list.append (res) - self ['list']. list = self.list + res = (_('Update NeoBoot on all images.'), png, 7) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Update TV list on installed image.'), png, 8) - self.list.append (res) - self ['list']. list = self.list + res = (_('Update TV list on installed image.'), png, 8) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Update IPTVPlayer on installed image.'), png, 9) - self.list.append (res) - self ['list']. list = self.list + res = (_('Update IPTVPlayer on installed image.'), png, 9) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Update FeedExtra on the installed image.'), png, 10) - self.list.append (res) - self ['list']. list = self.list + res = (_('Update FeedExtra on the installed image.'), png, 10) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Removing the root password.'), png, 11) - self.list.append (res) - self ['list']. list = self.list + res = (_('Removing the root password.'), png, 11) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Check the correctness of neoboot installation'), png, 12) - self.list.append (res) - self ['list']. list = self.list + res = (_('Check the correctness of neoboot installation'), png, 12) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Skin change'), png, 13) - self.list.append (res) - self ['list']. list = self.list + res = (_('Skin change'), png, 13) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Block or unlock skins.'), png, 14) - self.list.append (res) - self ['list']. list = self.list + res = (_('Block or unlock skins.'), png, 14) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Mount Internal Flash'), png, 15) - self.list.append (res) - self ['list']. list = self.list + res = (_('Mount Internal Flash'), png, 15) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Deleting languages'), png, 16) - self.list.append (res) - self ['list']. list = self.list + res = (_('Deleting languages'), png, 16) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Updates feed cam OpenATV softcam'), png, 17) - self.list.append (res) - self ['list']. list = self.list + res = (_('Updates feed cam OpenATV softcam'), png, 17) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Create swap- file.'), png, 18) - self.list.append (res) - self ['list']. list = self.list + res = (_('Create swap- file.'), png, 18) + self.list.append(res) + self['list']. list = self.list - res = (_ ('Supported sat tuners'), png, 19) - self.list.append (res) - self ['list']. list = self.list + res = (_('Supported sat tuners'), png, 19) + self.list.append(res) + self['list']. list = self.list - res = (_ ('NeoBoot Information'), png, 20) - self.list.append (res) - self ['list']. list = self.list + res = (_('NeoBoot Information'), png, 20) + self.list.append(res) + self['list']. list = self.list - res = (_ ('NeoBoot donate'), png, 21) - self.list.append (res) - self ['list']. list = self.list + res = (_('NeoBoot donate'), png, 21) + self.list.append(res) + self['list']. list = self.list def KeyOk(self): @@ -512,7 +512,7 @@ class MBRestore(Screen): image = self['list'].getCurrent() if image: self.delimage = image.strip() - message = (_('Software selected: %s remove ?') % image ) + message = (_('Software selected: %s remove ?') % image) ybox = self.session.openWithCallback(self.dodeleteback, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_('Confirmation of Deletion...')) @@ -725,7 +725,7 @@ class UnistallMultiboot(Screen): self.close() def checkNeo(self): - if not fileCheck(''+LinkNeoBoot+ '/.location') and not fileCheck(' ' + getNeoLocation() + 'ImageBoot/.neonextboot') : + if not fileCheck(''+LinkNeoBoot+ '/.location') and not fileCheck(' ' + getNeoLocation() + 'ImageBoot/.neonextboot'): self.restareE2() else: self.close() @@ -794,7 +794,7 @@ class ReinstllNeoBoot2(Screen): image = self['list'].getCurrent() if image: self.delimage = image.strip() - message = (_('Software selected: %s remove ?') % image ) + message = (_('Software selected: %s remove ?') % image) ybox = self.session.openWithCallback(self.dodeleteback, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_('Confirmation of Deletion...')) @@ -887,7 +887,7 @@ class MyUpgrade2(Screen): self.myClose(_('Sorry, NeoBoot can installed or upgraded only when booted from Flash STB')) self.close() else: - for fn in listdir('%sImageBoot' % getNeoLocation() ): + for fn in listdir('%sImageBoot' % getNeoLocation()): dirfile = '%sImageBoot/' % getNeoLocation() + fn if isdir(dirfile): target = dirfile + '' +LinkNeoBoot+ '' @@ -1198,7 +1198,7 @@ class CheckInstall(Screen): self.myClose(_('Sorry, Neoboot can be installed or upgraded only when booted from Flash')) def neocheck2(self): - os.system(_('rm -f ' + LinkNeoBoot + '/files/modulecheck; echo %s - %s > ' +LinkNeoBoot+ '/files/modulecheck') % (getBoxModelVU(), getCPUSoC()) ) + os.system(_('rm -f ' + LinkNeoBoot + '/files/modulecheck; echo %s - %s > ' +LinkNeoBoot+ '/files/modulecheck') % (getBoxModelVU(), getCPUSoC())) os.system('echo "\n====================================================>\nCheck result:" >> ' + LinkNeoBoot + '/files/modulecheck') os.system('echo "* neoboot location:" >> ' +LinkNeoBoot+ '/files/modulecheck; cat "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/.location" >> ' +LinkNeoBoot+ '/files/modulecheck') os.system('echo "\n* neoboot location install:" >> ' +LinkNeoBoot+ '/files/modulecheck; cat "/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/bin/install" >> ' +LinkNeoBoot+ '/files/modulecheck') @@ -1337,7 +1337,7 @@ class SkinChange(Screen): system('cp -r ' + LinkNeoBoot + '/images/sf4008.png ' + LinkNeoBoot + '/images/box.png') elif getBoxHostName() == 'ustym4kpro': system('cp -r ' + LinkNeoBoot + '/images/ustym4kpro.png ' + LinkNeoBoot + '/images/box.png') - elif getBoxHostName() == 'h7' or getBoxHostName() == 'zgemmah7' : + elif getBoxHostName() == 'h7' or getBoxHostName() == 'zgemmah7': system('cp -r ' + LinkNeoBoot + '/images/zgmmah7.png ' + LinkNeoBoot + '/images/box.png') elif getBoxHostName() == 'vusolo2': system('cp -r ' + LinkNeoBoot + '/images/solo2.png ' + LinkNeoBoot + '/images/box.png') @@ -1431,7 +1431,7 @@ class BlocUnblockImageSkin(Screen): image = self['list'].getCurrent() if image: self.delimage = image.strip() - message = (_('Select Yes to lock or No to unlock.\n %s ?') % image ) + message = (_('Select Yes to lock or No to unlock.\n %s ?') % image) ybox = self.session.openWithCallback(self.Block_Unlock_Skin, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_('Confirmation...')) @@ -1508,7 +1508,7 @@ class InternalFlash(Screen): os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p4 /media/InternalFlash') if os.path.exists('/proc/stb/info/boxtype'): - if getCPUSoC() == 'bcm7251s' or getBoxHostName() == 'h7' or getBoxHostName() == 'zgemmah7' : + if getCPUSoC() == 'bcm7251s' or getBoxHostName() == 'h7' or getBoxHostName() == 'zgemmah7': os.system('mkdir -p /media/InternalFlash; mount /dev/mmcblk0p3 /media/InternalFlash') if os.path.exists('/proc/stb/info/boxtype'): @@ -1601,7 +1601,7 @@ class DeletingLanguages(Screen): image = self['list'].getCurrent() if image: self.delimage = image.strip() - message = (_('File: %s remove ?') % image ) + message = (_('File: %s remove ?') % image) ybox = self.session.openWithCallback(self.dodeleteback, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_('Confirmation of Deletion...')) @@ -1924,7 +1924,7 @@ class Opis(Screen): if fileExists('/etc/init.d/volatile-media.sh.org'): system(' mv /etc/init.d/volatile-media.sh.org /etc/init.d/volatile-media.sh; rm -r /etc/init.d/volatile-media.sh.org; chmod 755 /etc/init.d/volatile-media.sh ') if os.path.isfile('%sImageBoot/.neonextboot' % getNeoLocation()): - os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; ' % (getNeoLocation(), getNeoLocation(), getNeoLocation()) ) + os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; ' % (getNeoLocation(), getNeoLocation(), getNeoLocation())) if os.path.isfile('%sImagesUpload/.kernel ' % getNeoLocation()): os.system('rm -r %sImagesUpload/.kernel' % getNeoLocation()) cmd = "echo -e '\n\n%s '" % _('Recovering setting....\n') @@ -1964,7 +1964,7 @@ class ReinstallKernel(Screen): def InfoCheck(self): if fileExists('/.multinfo'): if getCPUtype() == 'MIPS': - if not fileExists( '/boot/' + getBoxHostName() + '.vmlinux.gz'): + if not fileExists('/boot/' + getBoxHostName() + '.vmlinux.gz'): mess = _('Update available only from the image Flash.') self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) else: diff --git a/NeoBoot/plugin.py b/NeoBoot/plugin.py index 5c16d24..a1fef61 100644 --- a/NeoBoot/plugin.py +++ b/NeoBoot/plugin.py @@ -69,7 +69,7 @@ try: addFont(font_sagoe, 'tasat', 100, True) addFont(font_sagoe, 'dugme', 90, True) except: - print ("ERROR INSERTING FONT") + print("ERROR INSERTING FONT") def neoTranslator(): neolang = '' @@ -192,7 +192,7 @@ class NeoBootInstallation(Screen): if fileExists('/etc/fstab'): neoformat = getFormat() - writefile = open('/tmp/.neo_format' , 'w') + writefile = open('/tmp/.neo_format', 'w') writefile.write(neoformat) writefile.close() @@ -224,7 +224,7 @@ class NeoBootInstallation(Screen): os.system(" 'mount | sed '/sd/!d' | cut -d" " -f1,2,3,4,5' ") cmd = '/sbin/blkid ' system(cmd) - print ("[MULTI-BOOT]: "), cmd + print("[MULTI-BOOT]: "), cmd self.session.open(Console, _(' NeoBot - Available media:'), [message, cmd]) except Exception as e: loggscrash = time.localtime(time.time()) @@ -325,7 +325,7 @@ class NeoBootInstallation(Screen): self.session.open(MessageBox, _('The directory %s is not a ext2, ext3, ext4 or nfs partition.\nMake sure you select a valid partition type to install.') % dir, type=MessageBox.TYPE_ERROR) return False - elif getFormat() == 'ext4' or getFormat() == 'ext3' or getFormat() == 'ext2' or getFormat() == 'nfs' : + elif getFormat() == 'ext4' or getFormat() == 'ext3' or getFormat() == 'ext2' or getFormat() == 'nfs': return True else: @@ -413,7 +413,7 @@ class NeoBootInstallation(Screen): if yesno: self.first_installation() else: - self.myclose2(_('NeoBoot has not been installed ! :(' )) + self.myclose2(_('NeoBoot has not been installed ! :(')) def first_installation(self): check = False @@ -436,11 +436,11 @@ class NeoBootInstallation(Screen): self.close() def install2(self, yesno): - print ("yesno:"), yesno + print("yesno:"), yesno if yesno: self.first_installationNeoBoot() else: - self.myclose2(_('NeoBoot has not been installed ! :(' )) + self.myclose2(_('NeoBoot has not been installed ! :(')) def first_installationNeoBoot(self): self.mysel = self['config'].getCurrent() @@ -457,13 +457,13 @@ class NeoBootInstallation(Screen): out.close() if os.path.isfile('%sImageBoot/.neonextboot' % getNeoLocation()): - os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; rm -f %sImageBoot/.imagedistro; rm -f %sImageBoot/.initneo.log; rm -f %sImageBoot/.updateversion' % ( getNeoLocation(), getNeoLocation(), getNeoLocation(), getNeoLocation(), getNeoLocation(), getNeoLocation()) ) + os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; rm -f %sImageBoot/.imagedistro; rm -f %sImageBoot/.initneo.log; rm -f %sImageBoot/.updateversion' % (getNeoLocation(), getNeoLocation(), getNeoLocation(), getNeoLocation(), getNeoLocation(), getNeoLocation())) if os.path.isfile('%sImageBoot/.neonextboot' % getNeoLocation()): - os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; ' % (getNeoLocation(), getNeoLocation(), getNeoLocation()) ) + os.system('rm -f /etc/neoimage; rm -f /etc/imageboot; rm -f %sImageBoot/.neonextboot; rm -f %sImageBoot/.version; rm -f %sImageBoot/.Flash; ' % (getNeoLocation(), getNeoLocation(), getNeoLocation())) - if os.path.isfile('%sImagesUpload/.kernel/zImage*.ipk or %sImagesUpload/.kernel/zImage*.bin' % ( getNeoLocation(), getNeoLocation()) ): - os.system('rm -f %sImagesUpload/.kernel/zImage*.ipk; rm -f %sImagesUpload/.kernel/zImage*.bin' % ( getNeoLocation(),getNeoLocation()) ) + if os.path.isfile('%sImagesUpload/.kernel/zImage*.ipk or %sImagesUpload/.kernel/zImage*.bin' % (getNeoLocation(), getNeoLocation())): + os.system('rm -f %sImagesUpload/.kernel/zImage*.ipk; rm -f %sImagesUpload/.kernel/zImage*.bin' % (getNeoLocation(),getNeoLocation())) if fileExists('/etc/issue.net'): try: @@ -523,7 +523,7 @@ class NeoBootInstallation(Screen): writefile.write(imagever) writefile.close() - if not os.path.isfile('/etc/name') : + if not os.path.isfile('/etc/name'): if os.system('opkg update; opkg list-installed | grep python-subprocess') != 0: os.system('opkg install python-subprocess') if os.system('opkg list-installed | grep python-argparse') != 0: @@ -552,33 +552,33 @@ class NeoBootInstallation(Screen): if os.system('opkg list-installed | grep mtd-utils-ubifs') != 0: os.system('opkg install mtd-utils-ubifs') # STB ARM - if getCPUtype() == "ARMv7" : + if getCPUtype() == "ARMv7": if getBoxHostName() == "vuduo4k" and getBoxHostName() != "ustym4kpro": - os.system('cd ' + LinkNeoBoot + '/' ) + os.system('cd ' + LinkNeoBoot + '/') os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cp -Rf ' + LinkNeoBoot + '/bin/neoinitarmvuDuo4k /sbin/neoinitarmvu; mv ' + LinkNeoBoot + '/tmpfiles/runpy/duo4k_run.py ' + LinkNeoBoot + '/run.py; cd') os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu') - os.system('dd if=/dev/mmcblk0p6 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ) + os.system('dd if=/dev/mmcblk0p6 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())) os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/vuDuo4Kmmcblk0p6.sh ' + LinkNeoBoot + '/files/kernel.sh; cd') elif getBoxHostName() == "vuduo4kse" and getBoxHostName() != "vuultimo4k" and getBoxHostName() != "ustym4kpro": - os.system('cd ' + LinkNeoBoot + '/' ) + os.system('cd ' + LinkNeoBoot + '/') os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cp -Rf ' + LinkNeoBoot + '/bin/neoinitarmvuDuo4k /sbin/neoinitarmvu; mv ' + LinkNeoBoot + '/tmpfiles/runpy/duo4kse_run.py ' + LinkNeoBoot + '/run.py; cd') os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu') - os.system('dd if=/dev/mmcblk0p6 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ) + os.system('dd if=/dev/mmcblk0p6 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())) os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/vuDuo4Ksemmcblk0p6.sh ' + LinkNeoBoot + '/files/kernel.sh; cd') elif getBoxHostName() == "vuzero4k" and getBoxHostName() != "ustym4kpro": - os.system('cd ' + LinkNeoBoot + '/' ) + os.system('cd ' + LinkNeoBoot + '/') os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cp -Rf ' + LinkNeoBoot + '/bin/neoinitarmvu /sbin/neoinitarmvu; cd') os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu') - os.system('dd if=/dev/mmcblk0p4 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ) + os.system('dd if=/dev/mmcblk0p4 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())) os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/vuZero4Kmmcblk0p4.sh ' + LinkNeoBoot + '/files/kernel.sh; mv ' + LinkNeoBoot + '/tmpfiles/runpy/zero4k_run.py ' + LinkNeoBoot + '/run.py; rm -f ' + LinkNeoBoot + '/bin/neoinitarmvuDuo4k; cd') elif getBoxHostName() == "vuultimo4k" or getBoxHostName() == "vusolo4k" or getBoxHostName() == "vuuno4k" or getBoxHostName() == "vuuno4kse" and getBoxHostName() != "ustym4kpro": - os.system('cd ' + LinkNeoBoot + '/' ) + os.system('cd ' + LinkNeoBoot + '/') os.system('cp -Rf ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; cp -Rf ' + LinkNeoBoot + '/bin/neoinitarmvu /sbin/neoinitarmvu; cd') os.system('chmod 755 /sbin/neoinitarm; chmod 755 /sbin/neoinitarmvu') - os.system('dd if=/dev/mmcblk0p1 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ) + os.system('dd if=/dev/mmcblk0p1 of=%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())) os.system('mv ' + LinkNeoBoot + '/tmpfiles/target/vu_mmcblk0p1.sh ' + LinkNeoBoot + '/files/kernel.sh; mv ' + LinkNeoBoot + '/tmpfiles/runpy/vu4k_run.py ' + LinkNeoBoot + '/run.py; rm -f; rm -f ' + LinkNeoBoot + '/bin/neoinitarmvuDuo4k; cd') else: os.system('cp -f ' + LinkNeoBoot + '/bin/neoinitarm /sbin/neoinitarm; chmod 0755 /sbin/neoinitarm; ln -sfn /sbin/neoinitarm /sbin/init; mv ' + LinkNeoBoot + '/tmpfiles/runpy/arm_run.py ' + LinkNeoBoot + '/run.py; rm -f ' + LinkNeoBoot + '/bin/neoinitarmvuDuo4k; cd') @@ -586,18 +586,18 @@ class NeoBootInstallation(Screen): elif getCPUtype() == 'MIPS': #vuplus stb mtd1 if getBoxHostName() == 'bm750' or getBoxHostName() == 'vuduo' or getBoxHostName() == 'vusolo' or getBoxHostName() == 'vuuno' or getBoxHostName() == 'vuultimo': - if fileExists ('/usr/sbin/nanddump'): - os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/sbin/nanddump /dev/mtd1 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' ) - elif not fileExists ('/usr/sbin/nanddump'): - os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; ' + LinkNeoBoot + '/bin/nanddump_mips /dev/mtd1 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' ) + if fileExists('/usr/sbin/nanddump'): + os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/sbin/nanddump /dev/mtd1 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz') + elif not fileExists('/usr/sbin/nanddump'): + os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; ' + LinkNeoBoot + '/bin/nanddump_mips /dev/mtd1 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz') os.system('cd ' + LinkNeoBoot + '/; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; mv ' + LinkNeoBoot + '/tmpfiles/target/vu_dev_mtd1.sh ' + LinkNeoBoot + '/files/kernel.sh;mv ' + LinkNeoBoot + '/tmpfiles/runpy/vu_mtd1_run.py ' + LinkNeoBoot + '/run.py; cd') #vuplus stb mtd2 elif getBoxHostName() == 'vusolo2' or getBoxHostName() == 'vuduo2' or getBoxHostName() == 'vusolose' or getBoxHostName() == 'vuzero': - if fileExists ('/usr/sbin/nanddump'): - os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/sbin/nanddump /dev/mtd2 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' ) - elif not fileExists ('/usr/sbin/nanddump'): - os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; ' + LinkNeoBoot + '/bin/nanddump_mips /dev/mtd2 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz' ) + if fileExists('/usr/sbin/nanddump'): + os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; /usr/sbin/nanddump /dev/mtd2 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz') + elif not fileExists('/usr/sbin/nanddump'): + os.system('cd ' + getNeoLocation() + 'ImagesUpload/.kernel/; ' + LinkNeoBoot + '/bin/nanddump_mips /dev/mtd2 > vmlinux.gz; mv ./vmlinux.gz ./' + getBoxHostName() + '.vmlinux.gz') os.system('cd ' + LinkNeoBoot + '/; rm ./bin/fontforneoboot.ttf; rm ./bin/libpngneo; mv ' + LinkNeoBoot + '/tmpfiles/target/vu_dev_mtd2.sh ' + LinkNeoBoot + '/files/kernel.sh; mv ' + LinkNeoBoot + '/tmpfiles/runpy/vu_mtd2_run.py ' + LinkNeoBoot + '/run.py; cd') #Other stb MIPS @@ -616,7 +616,7 @@ class NeoBootInstallation(Screen): self.messagebox = self.session.open(MessageBox, _('The tuner is not supported by NeoBoot.\nContact the author.\nNo proper STB for installation !!!!'), type=MessageBox.TYPE_ERROR) if fileExists('/home/root/vmlinux.gz'): - os.system('mv -f /home/root/vmlinux.gz %sImagesUpload/.kernel/%s.vmlinux.gz' % (getNeoLocation(), getBoxHostName()) ) + os.system('mv -f /home/root/vmlinux.gz %sImagesUpload/.kernel/%s.vmlinux.gz' % (getNeoLocation(), getBoxHostName())) if fileExists('' + LinkNeoBoot + '/ubi_reader_mips') or fileExists('' + LinkNeoBoot + '/ubi_reader_arm') and fileExists('' + LinkNeoBoot + '/ubi_reader'): os.system('rm -r ' + LinkNeoBoot + '/ubi_reader ') @@ -634,10 +634,10 @@ class NeoBootInstallation(Screen): elif getLabelDisck() == 'LABEL=': cmd = "echo -e '\n%s '" % _('Installed succesfully NEOBOOT!\nNeoBoot has detected that the disks have been marked.\nRecommended total restart of the tuner\n') else: - self.myclose2(_('NeoBoot has not been installed ! :(' )) + self.myclose2(_('NeoBoot has not been installed ! :(')) if os.path.isfile('/etc/name'): - self.myclose2(_('The plug-in has been successfully installed.' )) + self.myclose2(_('The plug-in has been successfully installed.')) else: if not fileExists('/etc/name'): os.system('touch /etc/name') @@ -762,7 +762,7 @@ class NeoBootImageChoose(Screen): def DownloadImageOnline(self): if not os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/ImageDownloader/download.py'): - message = _('Plugin ImageDownloader not installed!\nInstall plugin to download new image? \and---Continue ?---' ) + message = _('Plugin ImageDownloader not installed!\nInstall plugin to download new image? \and---Continue ?---') ybox = self.session.openWithCallback(self.InstallImageDownloader, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_('Installation')) else: @@ -801,7 +801,7 @@ class NeoBootImageChoose(Screen): mess = _('Geen internet') self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) else: - mess = _('Upload image files in zip formats to the ImagesUpload location.' ) + mess = _('Upload image files in zip formats to the ImagesUpload location.') self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) def chackkernel(self): @@ -851,7 +851,7 @@ class NeoBootImageChoose(Screen): except: False - if not fileExists('/tmp/.finishdate') or not fileExists('/tmp/.nkod') or fileExists('/.multinfo') : + if not fileExists('/tmp/.finishdate') or not fileExists('/tmp/.nkod') or fileExists('/.multinfo'): if checkInternet(): pass else: @@ -859,21 +859,21 @@ class NeoBootImageChoose(Screen): self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) if not fileExists('/.multinfo'): - out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w' ) + out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w') out.write('Flash') out.close() self.close() elif fileExists('/.multinfo'): - with open('/.multinfo', 'r' ) as f: + with open('/.multinfo', 'r') as f: imagefile = f.readline().strip() f.close() - out = open('%sImageBoot/.neonextboot'% getNeoLocation(), 'w' ) + out = open('%sImageBoot/.neonextboot'% getNeoLocation(), 'w') out.write(imagefile) out.close() else: system('touch /tmp/.init_reboot') - out = open('%sImageBoot/.neonextboot' % getNeoLocation() , 'w') + out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w') out.write('Flash') out.close() self.close() @@ -923,7 +923,7 @@ class NeoBootImageChoose(Screen): system('mkdir /usr/lib/periodon') else: if getButtonPin() == 'pinok': - os.system('sleep 2; rm -f /tmp/gut*; date %s > /usr/lib/periodon/.accessdate' % UPDATEDATE ) + os.system('sleep 2; rm -f /tmp/gut*; date %s > /usr/lib/periodon/.accessdate' % UPDATEDATE) if fileExists('/usr/lib/periodon/.accessdate') and fileExists('/usr/lib/periodon/.kodn'): mess = _('Bravo! Neoboot vip full version activated OK!\nPlease restart your system E2.') self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) @@ -981,7 +981,7 @@ class NeoBootImageChoose(Screen): mess = _('Downloading available only from the image Flash.') self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) else: - out = open('%sImageBoot/.neonextboot' % getNeoLocation() , 'w') + out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w') out.write('Flash') out.close() message = _('\n\n\n') @@ -1200,7 +1200,7 @@ class NeoBootImageChoose(Screen): f2.close() self['label6'].setText(mypath3) else: - f2 = open('%sImageBoot/.neonextboot' % getNeoLocation() , 'r' ) + f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r') mypath3 = f2.readline().strip() f2.close() self['label6'].setText(mypath3) @@ -1221,7 +1221,7 @@ class NeoBootImageChoose(Screen): self['label20'].setText(strview) self['label17'].setText(readline('/etc/hostname')) - self['label19'].setText(readline('%sImagesUpload/.kernel/used_flash_kernel' % getNeoLocation() )) + self['label19'].setText(readline('%sImagesUpload/.kernel/used_flash_kernel' % getNeoLocation())) strview = UPDATEVERSION self['label10'].setText(strview) @@ -1277,14 +1277,14 @@ class NeoBootImageChoose(Screen): self.session.open(MessageBox, _('Sorry you cannot delete the image currently booted from.'), MessageBox.TYPE_INFO, 5) else: - out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w' ) + out = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'w') out.write('Flash') out.close() message = _('Delete the selected image - ') + self.mysel + _('\nDelete ?') ybox = self.session.openWithCallback(self.RemoveIMAGE, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_('Delete Confirmation')) except: - print ("no image to remove") + print("no image to remove") else: self.mysel @@ -1300,7 +1300,7 @@ class NeoBootImageChoose(Screen): self['config'].setList(self.list) self.updateList() except: - print (" ") + print(" ") def RemoveIMAGE(self, yesno): if yesno: @@ -1381,7 +1381,7 @@ class NeoBootImageChoose(Screen): images = False myimages=listdir('%sImagesUpload' % getNeoLocation()) - print (myimages) + print(myimages) for fil in myimages: if fil.endswith(".zip"): images=True @@ -1417,13 +1417,13 @@ class NeoBootImageChoose(Screen): def DownloaderImage(self): if not os.path.exists('/usr/lib/enigma2/python/Plugins/Extensions/ImageDownloader/download.py'): - message = (_('The %sImagesUpload directory is EMPTY!!!\nInstall the plugin to download new image online ?\n --- Continue? ---') % getNeoLocation() ) + message = (_('The %sImagesUpload directory is EMPTY!!!\nInstall the plugin to download new image online ?\n --- Continue? ---') % getNeoLocation()) ybox = self.session.openWithCallback(self.ImageDownloader, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_('Installation')) elif fileExists('/usr/lib/python3.8') and fileExists('/.multinfo'): self.session.open(MessageBox, _('Sorry, cannot open neo menu install image.'), type=MessageBox.TYPE_ERROR) else: - message = (_('Catalog %sImagesUpload directory is empty\nPlease upload the image files in zip or nfi formats to install') % getNeoLocation() ) + message = (_('Catalog %sImagesUpload directory is empty\nPlease upload the image files in zip or nfi formats to install') % getNeoLocation()) self.session.open(MessageBox, message, MessageBox.TYPE_INFO) def ImageDownloader(self, yesno): @@ -1447,7 +1447,7 @@ class NeoBootImageChoose(Screen): self.session.open(MessageBox, _('The plug-in has been successfully installed.'), MessageBox.TYPE_INFO, 5) self.close() else: - mess = (_('Directory %sImagesUpload is empty\nPlease upload the image files in zip or nfi formats to install') % getNeoLocation() ) + mess = (_('Directory %sImagesUpload is empty\nPlease upload the image files in zip or nfi formats to install') % getNeoLocation()) self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) else: mess = _('Geen internet') @@ -1468,13 +1468,13 @@ class NeoBootImageChoose(Screen): if 'Flash' in self.mysel: self.mysel = 'Flash' if self.mysel: - out = open('' + getNeoLocation() + 'ImageBoot/.neonextboot', 'w' ) + out = open('' + getNeoLocation() + 'ImageBoot/.neonextboot', 'w') out.write(self.mysel) out.close() if getImageNeoBoot() != "Flash": - if not fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): - message = _('After successful launch of the selected software\nyou must run the neoboot plugin\nif the software does not start or neoboot is not confirmed\nthe system will return to the internal flash memory\n\nPress OK or exit on the remote control to continue...' ) + if not fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): + message = _('After successful launch of the selected software\nyou must run the neoboot plugin\nif the software does not start or neoboot is not confirmed\nthe system will return to the internal flash memory\n\nPress OK or exit on the remote control to continue...') ybox = self.session.openWithCallback(self.StartReboot, MessageBox, message, MessageBox.TYPE_YESNO) ybox.setTitle(_('First start of software')) else: @@ -1582,7 +1582,7 @@ def main(session, **kwargs): else: os.system(_('echo %s > /tmp/.nkod') % UPDATEVERSION) from Plugins.Extensions.NeoBoot.files.stbbranding import getCheckInstal1, getCheckInstal2, getCheckInstal3 - if fileExists('/tmp/error_neo') : + if fileExists('/tmp/error_neo'): if fileExists('/tmp/error_neo'): os.system('rm -f /tmp/error_neo') if getCheckInstal1() == '1': @@ -1614,7 +1614,7 @@ def main(session, **kwargs): f.close() if fileExists('' + LinkNeoBoot + '/.location') and fileExists('%sImageBoot/.neonextboot' % getNeoLocation()): - f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r' ) + f2 = open('%sImageBoot/.neonextboot' % getNeoLocation(), 'r') mypath2 = f2.readline().strip() f2.close() if mypath2 != 'Flash' or mypath2 == 'Flash' and checkimage(): diff --git a/NeoBoot/tmpfiles/runpy/arm_run.py b/NeoBoot/tmpfiles/runpy/arm_run.py index b14fe04..9b6a62f 100644 --- a/NeoBoot/tmpfiles/runpy/arm_run.py +++ b/NeoBoot/tmpfiles/runpy/arm_run.py @@ -84,10 +84,10 @@ class StartImage(Screen): def KeyOk(self): if getImageNeoBoot() != 'Flash': - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() #--------------------------------------------- @@ -96,10 +96,10 @@ class StartImage(Screen): def StartImageInNeoBoot(self): if getImageNeoBoot() != 'Flash': - if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: - system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) if fileExists('/.multinfo') and getCPUtype() == 'ARMv7': os.system(' ' +LinkNeoBoot+ '/files/findsk.sh; mkdir -p /media/InternalFlash; mount /tmp/root /media/InternalFlash') @@ -137,7 +137,7 @@ class StartImage(Screen): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'cd /media/InternalFlash/linuxrootfs3; ln -sfn /sbin/init.sysvinit /media/InternalFlash/linuxrootfs3/sbin/init; sleep 5; reboot -d -f ' self.session.open(Console, _('NeoBoot-Reboot ....'), [cmd, cmd1]) - elif fileExists('/media/InternalFlash/linuxrootfs4/sbin/neoinitarm') : + elif fileExists('/media/InternalFlash/linuxrootfs4/sbin/neoinitarm'): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'cd /media/InternalFlash/linuxrootfs4; ln -sfn /sbin/init.sysvinit /media/InternalFlash/linuxrootfs4/sbin/init; sleep 5; reboot -d -f ' self.session.open(Console, _('NeoBoot-Reboot ....'), [cmd, cmd1]) diff --git a/NeoBoot/tmpfiles/runpy/duo4k_run.py b/NeoBoot/tmpfiles/runpy/duo4k_run.py index 7cc7d4a..934e497 100644 --- a/NeoBoot/tmpfiles/runpy/duo4k_run.py +++ b/NeoBoot/tmpfiles/runpy/duo4k_run.py @@ -85,10 +85,10 @@ class StartImage(Screen): def KeyOk(self): if getImageNeoBoot() != 'Flash': - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() #--------------------------------------------- getMountPointNeo2() @@ -96,10 +96,10 @@ class StartImage(Screen): def StartImageInNeoBoot(self): if getImageNeoBoot() != 'Flash': - if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: - system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) if fileExists('/.multinfo') and getCPUtype() == 'ARMv7': if getBoxVuModel() == 'duo4k': @@ -118,9 +118,9 @@ class StartImage(Screen): #################_____ARM____########################## #VUPLUS ARM - Duo4k vu_mmcblk0p6.sh - if getCPUSoC() == '7278' or getBoxHostName() == 'vuduo4k' : - if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ): - mess = (_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin') % (getNeoLocation(), getBoxHostName()) ) + if getCPUSoC() == '7278' or getBoxHostName() == 'vuduo4k': + if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())): + mess = (_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin') % (getNeoLocation(), getBoxHostName())) self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) else: if getImageNeoBoot() == 'Flash': @@ -134,20 +134,20 @@ class StartImage(Screen): elif getImageNeoBoot() != 'Flash': if not fileExists('/.multinfo'): - if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'sleep 5; ln -sfn /sbin/neoinitarm /sbin/init; /etc/init.d/reboot' - elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'ln -sfn /sbin/neoinitarmvu /sbin/init; ' + LinkNeoBoot + '/files/kernel.sh ' elif fileExists('/.multinfo'): - if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'dd if=' + getNeoLocation() + 'ImagesUpload/.kernel/flash-kernel-' + getBoxHostName() + '.bin of=/dev/mmcblk0p6; cd /media/InternalFlash; ln -sf "neoinitarm" "/media/InternalFlash/sbin/init" ; sleep 2; reboot -dfhi ' - elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'cd /media/InternalFlash; ln -sf "neoinitarmvu" "/media/InternalFlash/sbin/init"; ' + LinkNeoBoot + '/files/kernel.sh ' diff --git a/NeoBoot/tmpfiles/runpy/duo4kse_run.py b/NeoBoot/tmpfiles/runpy/duo4kse_run.py index bdca149..4a9ea43 100644 --- a/NeoBoot/tmpfiles/runpy/duo4kse_run.py +++ b/NeoBoot/tmpfiles/runpy/duo4kse_run.py @@ -85,10 +85,10 @@ class StartImage(Screen): def KeyOk(self): if getImageNeoBoot() != 'Flash': - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() #--------------------------------------------- getMountPointNeo2() @@ -96,10 +96,10 @@ class StartImage(Screen): def StartImageInNeoBoot(self): if getImageNeoBoot() != 'Flash': - if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: - system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) if fileExists('/.multinfo') and getCPUtype() == 'ARMv7': if getBoxVuModel() == 'duo4kse': @@ -118,9 +118,9 @@ class StartImage(Screen): #################_____ARM____########################## #VUPLUS ARM - Duo4kse vu_mmcblk0p6.sh - if getCPUSoC() == '7444s' or getBoxHostName() == 'vuduo4kse' and getBoxHostName() != 'vuultimo4k' : - if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ): - mess = (_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin') % (getNeoLocation(), getBoxHostName()) ) + if getCPUSoC() == '7444s' or getBoxHostName() == 'vuduo4kse' and getBoxHostName() != 'vuultimo4k': + if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())): + mess = (_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin') % (getNeoLocation(), getBoxHostName())) self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) else: if getImageNeoBoot() == 'Flash': @@ -134,20 +134,20 @@ class StartImage(Screen): elif getImageNeoBoot() != 'Flash': if not fileExists('/.multinfo'): - if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'sleep 5; ln -sfn /sbin/neoinitarm /sbin/init; /etc/init.d/reboot' - elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'ln -sfn /sbin/neoinitarmvu /sbin/init; ' + LinkNeoBoot + '/files/kernel.sh ' elif fileExists('/.multinfo'): - if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'dd if=' + getNeoLocation() + 'ImagesUpload/.kernel/flash-kernel-' + getBoxHostName() + '.bin of=/dev/mmcblk0p6; cd /media/InternalFlash; ln -sf "neoinitarm" "/media/InternalFlash/sbin/init" ; sleep 2; reboot -dfhi ' - elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'cd /media/InternalFlash; ln -sf "neoinitarmvu" "/media/InternalFlash/sbin/init"; ' + LinkNeoBoot + '/files/kernel.sh ' diff --git a/NeoBoot/tmpfiles/runpy/mips_run.py b/NeoBoot/tmpfiles/runpy/mips_run.py index 94fb1e5..40d87dd 100644 --- a/NeoBoot/tmpfiles/runpy/mips_run.py +++ b/NeoBoot/tmpfiles/runpy/mips_run.py @@ -84,10 +84,10 @@ class StartImage(Screen): def KeyOk(self): if getImageNeoBoot() != 'Flash': - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() #--------------------------------------------- getMountPointNeo2() @@ -95,10 +95,10 @@ class StartImage(Screen): def StartImageInNeoBoot(self): if getImageNeoBoot() != 'Flash': - if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: - system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) #system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh') self.sel = self['list'].getCurrent() @@ -134,4 +134,4 @@ class StartImage(Screen): os.system('echo "Flash " >> ' + getNeoLocation() + 'ImageBoot/.neonextboot') self.messagebox = self.session.open(MessageBox, _('It looks like it that multiboot does not support this STB.'), MessageBox.TYPE_INFO, 8) self.close() - \ No newline at end of file + diff --git a/NeoBoot/tmpfiles/runpy/vu4k_run.py b/NeoBoot/tmpfiles/runpy/vu4k_run.py index 767a61e..53a00cf 100644 --- a/NeoBoot/tmpfiles/runpy/vu4k_run.py +++ b/NeoBoot/tmpfiles/runpy/vu4k_run.py @@ -85,10 +85,10 @@ class StartImage(Screen): def KeyOk(self): if getImageNeoBoot() != "Flash": - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() #--------------------------------------------- getMountPointNeo2() @@ -96,10 +96,10 @@ class StartImage(Screen): def StartImageInNeoBoot(self): if getImageNeoBoot() != "Flash": - if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: - system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) if fileExists('/.multinfo') and getCPUtype() == "ARMv7": if getBoxVuModel() == "uno4kse" or getBoxVuModel() == "uno4k" or getBoxVuModel() == "ultimo4k" or getBoxVuModel() == "solo4k": @@ -115,9 +115,9 @@ class StartImage(Screen): if not fileExists('/bin/busybox.nosuid'): os.system('ln -sf "busybox" "/bin/busybox.nosuid" ') #VUPLUS ARM ultimo4k, solo4k, uno4k, uno4kse - mmcblk0p1.sh - if getCPUtype() == "ARMv7" and getBoxHostName() == "vuultimo4k" or getBoxHostName() == "vusolo4k" or getBoxHostName() == "vuuno4k" or getBoxHostName() == "vuuno4kse" : - if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ): - mess = (_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin') % (getNeoLocation(), getBoxHostName()) ) + if getCPUtype() == "ARMv7" and getBoxHostName() == "vuultimo4k" or getBoxHostName() == "vusolo4k" or getBoxHostName() == "vuuno4k" or getBoxHostName() == "vuuno4kse": + if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())): + mess = (_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin') % (getNeoLocation(), getBoxHostName())) self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) else: if getImageNeoBoot() == "Flash": @@ -131,19 +131,19 @@ class StartImage(Screen): elif getImageNeoBoot() != "Flash": if not fileExists("/.multinfo"): - if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'sleep 5; ln -sfn /sbin/neoinitarm /sbin/init; /etc/init.d/reboot' - elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'ln -sfn /sbin/neoinitarmvu /sbin/init; ' + LinkNeoBoot + '/files/kernel.sh ' elif fileExists("/.multinfo"): - if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'dd if=' + getNeoLocation() + 'ImagesUpload/.kernel/flash-kernel-' + getBoxHostName() + '.bin of=/dev/mmcblk0p1; cd /media/InternalFlash; ln -sf "neoinitarm" "/media/InternalFlash/sbin/init" ; sleep 2; reboot -dfhi ' - elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'cd /media/InternalFlash; ln -sf "neoinitarmvu" "/media/InternalFlash/sbin/init"; ' + LinkNeoBoot + '/files/kernel.sh ' diff --git a/NeoBoot/tmpfiles/runpy/vu_mtd1_run.py b/NeoBoot/tmpfiles/runpy/vu_mtd1_run.py index 6675060..bbfaf55 100644 --- a/NeoBoot/tmpfiles/runpy/vu_mtd1_run.py +++ b/NeoBoot/tmpfiles/runpy/vu_mtd1_run.py @@ -84,10 +84,10 @@ class StartImage(Screen): def KeyOk(self): if getImageNeoBoot() != 'Flash': - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() #--------------------------------------------- getMountPointNeo2() @@ -95,10 +95,10 @@ class StartImage(Screen): def StartImageInNeoBoot(self): if getImageNeoBoot() != 'Flash': - if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: - system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh') self.sel = self['list'].getCurrent() @@ -113,8 +113,8 @@ class StartImage(Screen): #VUPLUS MIPS vu_dev_mtd1.sh if getBoxHostName() == 'vuultimo' or getBoxHostName() == 'bm750' or getBoxHostName() == 'vuduo' or getBoxHostName() == 'vuuno' or getBoxHostName() == 'vusolo' or getBoxHostName() == 'vuduo': - if not fileExists('%sImagesUpload/.kernel/%s.vmlinux.gz' % (getNeoLocation(), getBoxHostName()) ): - self.myclose2(_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash kernel vmlinux.gz ' % getNeoLocation() )) + if not fileExists('%sImagesUpload/.kernel/%s.vmlinux.gz' % (getNeoLocation(), getBoxHostName())): + self.myclose2(_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash kernel vmlinux.gz ' % getNeoLocation())) else: if getImageNeoBoot() == 'Flash': if fileExists('/.multinfo'): @@ -131,16 +131,16 @@ class StartImage(Screen): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT-REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'ln -sfn /sbin/neoinitmipsvu /sbin/init; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh' - elif not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT > REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'ln -sfn /sbin/neoinitmipsvu /sbin/init; /etc/init.d/reboot' elif fileExists('/.multinfo'): - if not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT_REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') - cmd1 = 'flash_eraseall /dev/mtd1; sleep 2; ' + LinkNeoBoot + '/bin/nandwrite -p /dev/mtd1 %sImagesUpload/.kernel/%s.vmlinux.gz; /etc/init.d/reboot' % ( getNeoLocation(), getBoxHostName()) + cmd1 = 'flash_eraseall /dev/mtd1; sleep 2; ' + LinkNeoBoot + '/bin/nandwrite -p /dev/mtd1 %sImagesUpload/.kernel/%s.vmlinux.gz; /etc/init.d/reboot' % (getNeoLocation(), getBoxHostName()) - elif fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............REBOOT now...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh' diff --git a/NeoBoot/tmpfiles/runpy/vu_mtd2_run.py b/NeoBoot/tmpfiles/runpy/vu_mtd2_run.py index 2593c9e..40a532f 100644 --- a/NeoBoot/tmpfiles/runpy/vu_mtd2_run.py +++ b/NeoBoot/tmpfiles/runpy/vu_mtd2_run.py @@ -84,10 +84,10 @@ class StartImage(Screen): def KeyOk(self): if getImageNeoBoot() != 'Flash': - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() #--------------------------------------------- getMountPointNeo2() @@ -95,10 +95,10 @@ class StartImage(Screen): def StartImageInNeoBoot(self): if getImageNeoBoot() != 'Flash': - if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: - system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) system('chmod 755 /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh') self.sel = self['list'].getCurrent() @@ -113,8 +113,8 @@ class StartImage(Screen): #VUPLUS MIPS vu_dev_mtd2.sh if getBoxHostName() == 'vusolo2' or getBoxHostName() == 'vusolose' or getBoxHostName() == 'vuduo2' or getBoxHostName() == 'vuzero': - if not fileExists('%sImagesUpload/.kernel/%s.vmlinux.gz' % (getNeoLocation(), getBoxHostName()) ): - self.myclose2(_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash kernel vmlinux.gz ' % getNeoLocation() )) + if not fileExists('%sImagesUpload/.kernel/%s.vmlinux.gz' % (getNeoLocation(), getBoxHostName())): + self.myclose2(_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash kernel vmlinux.gz ' % getNeoLocation())) else: if getImageNeoBoot() == 'Flash': if fileExists('/.multinfo'): @@ -131,16 +131,16 @@ class StartImage(Screen): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT-REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'ln -sfn /sbin/neoinitmipsvu /sbin/init; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh' - elif not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT > REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'ln -sfn /sbin/neoinitmipsvu /sbin/init; /etc/init.d/reboot' elif fileExists('/.multinfo'): - if not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT_REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') - cmd1 = 'flash_eraseall /dev/mtd2; sleep 2; ' + LinkNeoBoot + '/bin/nandwrite -p /dev/mtd2 %sImagesUpload/.kernel/%s.vmlinux.gz; /etc/init.d/reboot' % ( getNeoLocation(), getBoxHostName()) + cmd1 = 'flash_eraseall /dev/mtd2; sleep 2; ' + LinkNeoBoot + '/bin/nandwrite -p /dev/mtd2 %sImagesUpload/.kernel/%s.vmlinux.gz; /etc/init.d/reboot' % (getNeoLocation(), getBoxHostName()) - elif fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/%s.vmlinux.gz' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............REBOOT now...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = '/usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh' @@ -154,4 +154,4 @@ class StartImage(Screen): def myclose2(self, message): self.session.open(MessageBox, message, MessageBox.TYPE_INFO) - self.close() \ No newline at end of file + self.close() diff --git a/NeoBoot/tmpfiles/runpy/zero4k_run.py b/NeoBoot/tmpfiles/runpy/zero4k_run.py index 53fa941..2907ae5 100644 --- a/NeoBoot/tmpfiles/runpy/zero4k_run.py +++ b/NeoBoot/tmpfiles/runpy/zero4k_run.py @@ -84,10 +84,10 @@ class StartImage(Screen): def KeyOk(self): if getImageNeoBoot() != 'Flash': - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() else: - os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % ( getNeoLocation(), getImageNeoBoot())) + os.system('rm -rf %sImageBoot/%s/usr/bin/enigma2_pre_start.sh' % (getNeoLocation(), getImageNeoBoot())) self.StartImageInNeoBoot() #--------------------------------------------- getMountPointNeo2() @@ -95,10 +95,10 @@ class StartImage(Screen): def StartImageInNeoBoot(self): if getImageNeoBoot() != 'Flash': - if fileExists('%sImageBoot/%s/.control_ok' % ( getNeoLocation(), getImageNeoBoot())): + if fileExists('%sImageBoot/%s/.control_ok' % (getNeoLocation(), getImageNeoBoot())): system('touch /tmp/.control_ok ') else: - system('touch %sImageBoot/%s/.control_boot_new_image ' % ( getNeoLocation(), getImageNeoBoot() )) + system('touch %sImageBoot/%s/.control_boot_new_image ' % (getNeoLocation(), getImageNeoBoot())) if fileExists('/.multinfo') and getCPUtype() == 'ARMv7': if getBoxVuModel() == 'zero4k': @@ -116,8 +116,8 @@ class StartImage(Screen): #################_____ARM____########################## #VUPLUS ARM - Zero4k vu_mmcblk0p4.sh if getBoxHostName() == 'vuzero4k' or getCPUSoC() == '72604': - if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName()) ): - mess = (_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin') % (getNeoLocation(), getBoxHostName()) ) + if not fileExists('%sImagesUpload/.kernel/flash-kernel-%s.bin' % (getNeoLocation(), getBoxHostName())): + mess = (_('Error - in the location %sImagesUpload/.kernel/ \nkernel file not found flash-kernel-%s.bin') % (getNeoLocation(), getBoxHostName())) self.session.open(MessageBox, mess, MessageBox.TYPE_INFO) else: if getImageNeoBoot() == 'Flash': @@ -131,20 +131,20 @@ class StartImage(Screen): elif getImageNeoBoot() != 'Flash': if not fileExists('/.multinfo'): - if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'sleep 5; ln -sfn /sbin/neoinitarm /sbin/init; /etc/init.d/reboot' - elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'ln -sfn /sbin/neoinitarmvu /sbin/init; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh ' elif fileExists('/.multinfo'): - if not fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + if not fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'dd if=' + getNeoLocation() + 'ImagesUpload/.kernel/flash-kernel-' + getBoxHostName() + '.bin of=/dev/mmcblk0p1; cd /media/InternalFlash; ln -sf "neoinitarm" "/media/InternalFlash/sbin/init" ; sleep 2; reboot -dfhi ' - elif fileExists('%sImageBoot/%s/boot/zImage.%s' % ( getNeoLocation(), getImageNeoBoot(), getBoxHostName())): + elif fileExists('%sImageBoot/%s/boot/zImage.%s' % (getNeoLocation(), getImageNeoBoot(), getBoxHostName())): cmd = "echo -e '\n\n%s '" % _('...............NEOBOOT - REBOOT...............\nPlease wait, in a moment the decoder will be restarted...') cmd1 = 'cd /media/InternalFlash; ln -sf "neoinitarmvu" "/media/InternalFlash/sbin/init"; /usr/lib/enigma2/python/Plugins/Extensions/NeoBoot/files/kernel.sh ' diff --git a/NeoBoot/ubi_reader_arm/argparse_neo.py b/NeoBoot/ubi_reader_arm/argparse_neo.py index 4d5d9f1..3861108 100644 --- a/NeoBoot/ubi_reader_arm/argparse_neo.py +++ b/NeoBoot/ubi_reader_arm/argparse_neo.py @@ -108,7 +108,7 @@ class HelpFormatter(object): for func, args in self.items: func(*args) - item_help = join([ func(*args) for func, args in self.items ]) + item_help = join([func(*args) for func, args in self.items]) if self.parent is not None: self.formatter._dedent() if not item_help: @@ -158,7 +158,7 @@ class HelpFormatter(object): for subaction in self._iter_indented_subactions(action): invocations.append(get_invocation(subaction)) - invocation_length = max([ len(s) for s in invocations ]) + invocation_length = max([len(s) for s in invocations]) action_length = invocation_length + self._current_indent self._action_max_length = max(self._action_max_length, action_length) self._add_item(self._format_action, [action]) @@ -175,7 +175,7 @@ class HelpFormatter(object): return help def _join_parts(self, part_strings): - return ''.join([ part for part in part_strings if part and part is not SUPPRESS ]) + return ''.join([part for part in part_strings if part and part is not SUPPRESS]) def _format_usage(self, usage, actions, groups, prefix): if prefix is None: @@ -196,7 +196,7 @@ class HelpFormatter(object): format = self._format_actions_usage action_usage = format(optionals + positionals, groups) - usage = ' '.join([ s for s in [prog, action_usage] if s ]) + usage = ' '.join([s for s in [prog, action_usage] if s]) text_width = self._width - self._current_indent if len(prefix) + len(usage) > text_width: part_regexp = '\\(.*?\\)+|\\[.*?\\]+|\\S+' @@ -305,7 +305,7 @@ class HelpFormatter(object): for i in sorted(inserts, reverse=True): parts[i:i] = [inserts[i]] - text = ' '.join([ item for item in parts if item is not None ]) + text = ' '.join([item for item in parts if item is not None]) open = '[\\[(]' close = '[\\])]' text = _re.sub('(%s) ' % open, '\\1', text) @@ -376,7 +376,7 @@ class HelpFormatter(object): if action.metavar is not None: result = action.metavar elif action.choices is not None: - choice_strs = [ str(choice) for choice in action.choices ] + choice_strs = [str(choice) for choice in action.choices] result = '{%s}' % ','.join(choice_strs) else: result = default_metavar @@ -404,7 +404,7 @@ class HelpFormatter(object): elif action.nargs == PARSER: result = '%s ...' % get_metavar(1) else: - formats = [ '%s' for _ in range(action.nargs) ] + formats = ['%s' for _ in range(action.nargs)] result = ' '.join(formats) % get_metavar(action.nargs) return result @@ -419,7 +419,7 @@ class HelpFormatter(object): params[name] = params[name].__name__ if params.get('choices') is not None: - choices_str = ', '.join([ str(c) for c in params['choices'] ]) + choices_str = ', '.join([str(c) for c in params['choices']]) params['choices'] = choices_str return self._get_help_string(action) % params @@ -450,7 +450,7 @@ class HelpFormatter(object): class RawDescriptionHelpFormatter(HelpFormatter): def _fill_text(self, text, width, indent): - return ''.join([ indent + line for line in text.splitlines(True) ]) + return ''.join([indent + line for line in text.splitlines(True)]) class RawTextHelpFormatter(RawDescriptionHelpFormatter): @@ -527,7 +527,7 @@ class Action(_AttributeHolder): 'choices', 'help', 'metavar'] - return [ (name, getattr(self, name)) for name in names ] + return [(name, getattr(self, name)) for name in names] def __call__(self, parser, namespace, values, option_string=None): raise NotImplementedError(_('.__call__() not defined')) @@ -913,7 +913,7 @@ class _ActionsContainer(object): def _handle_conflict_error(self, action, conflicting_actions): message = _('conflicting option string(s): %s') - conflict_string = ', '.join([ option_string for option_string, action in conflicting_actions ]) + conflict_string = ', '.join([option_string for option_string, action in conflicting_actions]) raise ArgumentError(action, message % conflict_string) def _handle_conflict_resolve(self, action, conflicting_actions): @@ -1024,7 +1024,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): 'formatter_class', 'conflict_handler', 'add_help'] - return [ (name, getattr(self, name)) for name in names ] + return [(name, getattr(self, name)) for name in names] def add_subparsers(self, **kwargs): if self._subparsers is not None: @@ -1055,10 +1055,10 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): return action def _get_optional_actions(self): - return [ action for action in self._actions if action.option_strings ] + return [action for action in self._actions if action.option_strings] def _get_positional_actions(self): - return [ action for action in self._actions if not action.option_strings ] + return [action for action in self._actions if not action.option_strings] def parse_args(self, args=None, namespace=None): args, argv = self.parse_known_args(args, namespace) @@ -1211,7 +1211,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): else: max_option_string_index = -1 while start_index <= max_option_string_index: - next_option_string_index = min([ index for index in option_string_indices if index >= start_index ]) + next_option_string_index = min([index for index in option_string_indices if index >= start_index]) if start_index != next_option_string_index: positionals_end_index = consume_positionals(start_index) if positionals_end_index > start_index: @@ -1241,7 +1241,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): if action in seen_non_default_actions: break else: - names = [ _get_action_name(action) for action in group._group_actions if action.help is not SUPPRESS ] + names = [_get_action_name(action) for action in group._group_actions if action.help is not SUPPRESS] msg = _('one of the arguments %s is required') self.error(msg % ' '.join(names)) @@ -1291,10 +1291,10 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): result = [] for i in range(len(actions), 0, -1): actions_slice = actions[:i] - pattern = ''.join([ self._get_nargs_pattern(action) for action in actions_slice ]) + pattern = ''.join([self._get_nargs_pattern(action) for action in actions_slice]) match = _re.match(pattern, arg_strings_pattern) if match is not None: - result.extend([ len(string) for string in match.groups() ]) + result.extend([len(string) for string in match.groups()]) break return result @@ -1317,7 +1317,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): return (action, option_string, explicit_arg) option_tuples = self._get_option_tuples(arg_string) if len(option_tuples) > 1: - options = ', '.join([ option_string for action, option_string, explicit_arg in option_tuples ]) + options = ', '.join([option_string for action, option_string, explicit_arg in option_tuples]) tup = (arg_string, options) self.error(_('ambiguous option: %s could match %s') % tup) elif len(option_tuples) == 1: @@ -1388,7 +1388,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def _get_values(self, action, arg_strings): if action.nargs not in [PARSER, REMAINDER]: - arg_strings = [ s for s in arg_strings if s != '--' ] + arg_strings = [s for s in arg_strings if s != '--'] if not arg_strings and action.nargs == OPTIONAL: if action.option_strings: value = action.const @@ -1408,12 +1408,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): value = self._get_value(action, arg_string) self._check_value(action, value) elif action.nargs == REMAINDER: - value = [ self._get_value(action, v) for v in arg_strings ] + value = [self._get_value(action, v) for v in arg_strings] elif action.nargs == PARSER: - value = [ self._get_value(action, v) for v in arg_strings ] + value = [self._get_value(action, v) for v in arg_strings] self._check_value(action, value[0]) else: - value = [ self._get_value(action, v) for v in arg_strings ] + value = [self._get_value(action, v) for v in arg_strings] for v in value: self._check_value(action, v) diff --git a/NeoBoot/ubi_reader_arm/ubi/block/sort.py b/NeoBoot/ubi_reader_arm/ubi/block/sort.py index cea8ca1..3f01628 100644 --- a/NeoBoot/ubi_reader_arm/ubi/block/sort.py +++ b/NeoBoot/ubi_reader_arm/ubi/block/sort.py @@ -19,7 +19,7 @@ def by_image_seq(blocks, image_seq): def by_range(blocks, block_range): peb_range = range(block_range[0], block_range[1]) - return [ i for i in blocks if i in peb_range ] + return [i for i in blocks if i in peb_range] def by_leb(blocks): diff --git a/NeoBoot/ubi_reader_mips/argparse_neo.py b/NeoBoot/ubi_reader_mips/argparse_neo.py index 4d5d9f1..3861108 100644 --- a/NeoBoot/ubi_reader_mips/argparse_neo.py +++ b/NeoBoot/ubi_reader_mips/argparse_neo.py @@ -108,7 +108,7 @@ class HelpFormatter(object): for func, args in self.items: func(*args) - item_help = join([ func(*args) for func, args in self.items ]) + item_help = join([func(*args) for func, args in self.items]) if self.parent is not None: self.formatter._dedent() if not item_help: @@ -158,7 +158,7 @@ class HelpFormatter(object): for subaction in self._iter_indented_subactions(action): invocations.append(get_invocation(subaction)) - invocation_length = max([ len(s) for s in invocations ]) + invocation_length = max([len(s) for s in invocations]) action_length = invocation_length + self._current_indent self._action_max_length = max(self._action_max_length, action_length) self._add_item(self._format_action, [action]) @@ -175,7 +175,7 @@ class HelpFormatter(object): return help def _join_parts(self, part_strings): - return ''.join([ part for part in part_strings if part and part is not SUPPRESS ]) + return ''.join([part for part in part_strings if part and part is not SUPPRESS]) def _format_usage(self, usage, actions, groups, prefix): if prefix is None: @@ -196,7 +196,7 @@ class HelpFormatter(object): format = self._format_actions_usage action_usage = format(optionals + positionals, groups) - usage = ' '.join([ s for s in [prog, action_usage] if s ]) + usage = ' '.join([s for s in [prog, action_usage] if s]) text_width = self._width - self._current_indent if len(prefix) + len(usage) > text_width: part_regexp = '\\(.*?\\)+|\\[.*?\\]+|\\S+' @@ -305,7 +305,7 @@ class HelpFormatter(object): for i in sorted(inserts, reverse=True): parts[i:i] = [inserts[i]] - text = ' '.join([ item for item in parts if item is not None ]) + text = ' '.join([item for item in parts if item is not None]) open = '[\\[(]' close = '[\\])]' text = _re.sub('(%s) ' % open, '\\1', text) @@ -376,7 +376,7 @@ class HelpFormatter(object): if action.metavar is not None: result = action.metavar elif action.choices is not None: - choice_strs = [ str(choice) for choice in action.choices ] + choice_strs = [str(choice) for choice in action.choices] result = '{%s}' % ','.join(choice_strs) else: result = default_metavar @@ -404,7 +404,7 @@ class HelpFormatter(object): elif action.nargs == PARSER: result = '%s ...' % get_metavar(1) else: - formats = [ '%s' for _ in range(action.nargs) ] + formats = ['%s' for _ in range(action.nargs)] result = ' '.join(formats) % get_metavar(action.nargs) return result @@ -419,7 +419,7 @@ class HelpFormatter(object): params[name] = params[name].__name__ if params.get('choices') is not None: - choices_str = ', '.join([ str(c) for c in params['choices'] ]) + choices_str = ', '.join([str(c) for c in params['choices']]) params['choices'] = choices_str return self._get_help_string(action) % params @@ -450,7 +450,7 @@ class HelpFormatter(object): class RawDescriptionHelpFormatter(HelpFormatter): def _fill_text(self, text, width, indent): - return ''.join([ indent + line for line in text.splitlines(True) ]) + return ''.join([indent + line for line in text.splitlines(True)]) class RawTextHelpFormatter(RawDescriptionHelpFormatter): @@ -527,7 +527,7 @@ class Action(_AttributeHolder): 'choices', 'help', 'metavar'] - return [ (name, getattr(self, name)) for name in names ] + return [(name, getattr(self, name)) for name in names] def __call__(self, parser, namespace, values, option_string=None): raise NotImplementedError(_('.__call__() not defined')) @@ -913,7 +913,7 @@ class _ActionsContainer(object): def _handle_conflict_error(self, action, conflicting_actions): message = _('conflicting option string(s): %s') - conflict_string = ', '.join([ option_string for option_string, action in conflicting_actions ]) + conflict_string = ', '.join([option_string for option_string, action in conflicting_actions]) raise ArgumentError(action, message % conflict_string) def _handle_conflict_resolve(self, action, conflicting_actions): @@ -1024,7 +1024,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): 'formatter_class', 'conflict_handler', 'add_help'] - return [ (name, getattr(self, name)) for name in names ] + return [(name, getattr(self, name)) for name in names] def add_subparsers(self, **kwargs): if self._subparsers is not None: @@ -1055,10 +1055,10 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): return action def _get_optional_actions(self): - return [ action for action in self._actions if action.option_strings ] + return [action for action in self._actions if action.option_strings] def _get_positional_actions(self): - return [ action for action in self._actions if not action.option_strings ] + return [action for action in self._actions if not action.option_strings] def parse_args(self, args=None, namespace=None): args, argv = self.parse_known_args(args, namespace) @@ -1211,7 +1211,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): else: max_option_string_index = -1 while start_index <= max_option_string_index: - next_option_string_index = min([ index for index in option_string_indices if index >= start_index ]) + next_option_string_index = min([index for index in option_string_indices if index >= start_index]) if start_index != next_option_string_index: positionals_end_index = consume_positionals(start_index) if positionals_end_index > start_index: @@ -1241,7 +1241,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): if action in seen_non_default_actions: break else: - names = [ _get_action_name(action) for action in group._group_actions if action.help is not SUPPRESS ] + names = [_get_action_name(action) for action in group._group_actions if action.help is not SUPPRESS] msg = _('one of the arguments %s is required') self.error(msg % ' '.join(names)) @@ -1291,10 +1291,10 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): result = [] for i in range(len(actions), 0, -1): actions_slice = actions[:i] - pattern = ''.join([ self._get_nargs_pattern(action) for action in actions_slice ]) + pattern = ''.join([self._get_nargs_pattern(action) for action in actions_slice]) match = _re.match(pattern, arg_strings_pattern) if match is not None: - result.extend([ len(string) for string in match.groups() ]) + result.extend([len(string) for string in match.groups()]) break return result @@ -1317,7 +1317,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): return (action, option_string, explicit_arg) option_tuples = self._get_option_tuples(arg_string) if len(option_tuples) > 1: - options = ', '.join([ option_string for action, option_string, explicit_arg in option_tuples ]) + options = ', '.join([option_string for action, option_string, explicit_arg in option_tuples]) tup = (arg_string, options) self.error(_('ambiguous option: %s could match %s') % tup) elif len(option_tuples) == 1: @@ -1388,7 +1388,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def _get_values(self, action, arg_strings): if action.nargs not in [PARSER, REMAINDER]: - arg_strings = [ s for s in arg_strings if s != '--' ] + arg_strings = [s for s in arg_strings if s != '--'] if not arg_strings and action.nargs == OPTIONAL: if action.option_strings: value = action.const @@ -1408,12 +1408,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): value = self._get_value(action, arg_string) self._check_value(action, value) elif action.nargs == REMAINDER: - value = [ self._get_value(action, v) for v in arg_strings ] + value = [self._get_value(action, v) for v in arg_strings] elif action.nargs == PARSER: - value = [ self._get_value(action, v) for v in arg_strings ] + value = [self._get_value(action, v) for v in arg_strings] self._check_value(action, value[0]) else: - value = [ self._get_value(action, v) for v in arg_strings ] + value = [self._get_value(action, v) for v in arg_strings] for v in value: self._check_value(action, v) diff --git a/NeoBoot/ubi_reader_mips/ubi/block/sort.py b/NeoBoot/ubi_reader_mips/ubi/block/sort.py index cea8ca1..3f01628 100644 --- a/NeoBoot/ubi_reader_mips/ubi/block/sort.py +++ b/NeoBoot/ubi_reader_mips/ubi/block/sort.py @@ -19,7 +19,7 @@ def by_image_seq(blocks, image_seq): def by_range(blocks, block_range): peb_range = range(block_range[0], block_range[1]) - return [ i for i in blocks if i in peb_range ] + return [i for i in blocks if i in peb_range] def by_leb(blocks): diff --git a/NeoBoot/unpack.py b/NeoBoot/unpack.py index c5cd9ae..8eeb60b 100644 --- a/NeoBoot/unpack.py +++ b/NeoBoot/unpack.py @@ -94,7 +94,7 @@ class InstallImage(Screen, ConfigListScreen): Screen.__init__(self, session) fn = 'NewImage' sourcelist = [] - for fn in os.listdir('%sImagesUpload' % getNeoLocation() ): + for fn in os.listdir('%sImagesUpload' % getNeoLocation()): if fn.find('.zip') != -1: fn = fn.replace('.zip', '') sourcelist.append((fn, fn)) @@ -179,8 +179,8 @@ class InstallImage(Screen, ConfigListScreen): self.list.append(getConfigListEntry(_('Source Image file'), self.source)) self.list.append(getConfigListEntry(_('Image Name'), self.target)) self.list.append(getConfigListEntry(_('Stop E2 processes during installation?'), self.stopenigma)) - self.list.append(getConfigListEntry(_('Copy files from Flash to the installed image ?'), self.CopyFiles )) - self.list.append(getConfigListEntry(_('Copy the kernel of the installed system (recommended ?'), self.CopyKernel )) + self.list.append(getConfigListEntry(_('Copy files from Flash to the installed image ?'), self.CopyFiles)) + self.list.append(getConfigListEntry(_('Copy the kernel of the installed system (recommended ?'), self.CopyKernel)) self.list.append(getConfigListEntry(_('Copy the channel list ?'), self.TvList)) self.list.append(getConfigListEntry(_('Copy network settings LAN-WLAN ?'), self.LanWlan)) self.list.append(getConfigListEntry(_('Copy the drivers ? (Recommended only other image.)'), self.Sterowniki)) @@ -267,7 +267,7 @@ class InstallImage(Screen, ConfigListScreen): str(self.PiconR.value), str(self.Kodi.value), str(self.BlackHole.value)) - print ("[MULTI-BOOT]: "), cmd + print("[MULTI-BOOT]: "), cmd from Plugins.Extensions.NeoBoot.plugin import PLUGINVERSION self.session.open(Console, _('NeoBoot v.%s - Install new image') % PLUGINVERSION, [message, cmd])