fixed bugs during install

master
idziubenko 3 years ago
parent 41d9ecd6c4
commit 560791b01b

@ -52,8 +52,8 @@ try:
def center(self):
screen = QtWidgets.QDesktopWidget().screenGeometry()
size = self.geometry()
self.move((screen.width() - size.width()) / 2,
(screen.height() - size.height()) / 2)
self.move((screen.width() - size.width()) // 2,
(screen.height() - size.height()) // 2)
@QtCore.pyqtSlot()
def dispatcher(self):

@ -4019,7 +4019,7 @@ gettext -d cl_template "$*"
p.pipe.wait()
if p.success():
self.executedFiles.append((code, execPath))
errdata = p.readerr().rstrip().decode("UTF-8")
errdata = p.readerr().rstrip()
if errdata:
for line in errdata.split('\n'):
if line:
@ -6745,7 +6745,7 @@ class ProgressTemplate(Template):
def numberProcessTemplates(self, number):
maximum = self.maximum or 1
value = number * 100 / maximum
value = number * 100 // maximum
if value != self.value:
self.setValueCallback(min(100, max(0, value)))
self.value = value

@ -112,7 +112,7 @@ class ConsoleColor256():
return "#{0:02x}{0:02x}{0:02x}".format((color - 232) * 11)
elif color >= 16:
color -= 16
return "#%s" % "".join(ConsoleColor256.colorHex[color / x % 6]
return "#%s" % "".join(ConsoleColor256.colorHex[color // x % 6]
for x in (36, 6, 1))
else:
return None

@ -224,7 +224,7 @@ class process(StdoutableProcess):
self.cacheerr = self.pipe.stderr.read()
except IOError:
self.cacheerr = b""
return self.cacheerr
return self.cacheerr.decode("UTF-8")
def readByLine(self):
_cacheerr = []
@ -244,7 +244,7 @@ class process(StdoutableProcess):
for fd in ret[0]:
if fd == _stdout:
s = self.pipe.stdout.readline()
yield s
yield s.decode("UTF-8")
self._cachedata.append(s)
if fd == _stderr:
s = self.pipe.stderr.readline()
@ -255,13 +255,13 @@ class process(StdoutableProcess):
s = self.pipe.stdout.readline()
if not s:
break
yield s
yield s.decode("UTF-8")
self._cachedata.append(s)
while True:
s = self.pipe.stderr.readline()
if not s:
break
yield s
yield s.decode("UTF-8")
_cacheerr.append(s)
break
except KeyboardInterrupt:
@ -309,6 +309,10 @@ class process(StdoutableProcess):
"""Next string from stdout"""
return next(self.__iter__())
def __next__(self):
"""Next string from stdout"""
return next(self.__iter__())
def returncode(self):
"""Get return code"""
self.read()
@ -568,10 +572,10 @@ class processProgress(process):
def __init__(self, command, *params, **kwarg):
process.__init__(self, command, *params, **kwarg)
self.readsize = kwarg.get("readsize", 10)
self.delimeter = re.compile("\n")
self.delimeter = re.compile(b"\n")
self.init(**kwarg)
self._cachedata = []
self.buf = ""
self.buf = b""
def init(self, *args, **kwarg):
pass
@ -587,7 +591,7 @@ class processProgress(process):
return strdata
def processBuffer(self, buf):
return ""
return b""
def progress(self):
try:
@ -596,7 +600,7 @@ class processProgress(process):
yield res
self._open()
if self.cacheresult is None:
self.buf = ""
self.buf = b""
fd = self.pipe.stdout.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
@ -1142,22 +1146,22 @@ class PercentProgress(processProgress):
end: конечный прогрессбар (по умолчанию)
atty: для получения данных создается pty
"""
#TODO probably full of encoding errors, needs testing
def init(self, *args, **kwargs):
self.rePerc = re.compile("(\d+(?:\.\d+)?)%", re.S)
self.rePerc = re.compile(b"(\d+(?:\.\d+)?)%", re.S)
self.part = kwargs.get("part", 1)
if self.part < 1:
self.part = 1
self.add_offset = 100 / self.part
self.add_offset = 100 // self.part
self.offset = 0 + kwargs.get("startpart", 0) * self.add_offset
self.is_end = kwargs.get("end", True)
self.stderr = STDOUT
self.delimeter = re.compile("[%s]" % kwargs.get("delimeter", "\n\r"))
self.delimeter = re.compile(bytes("[%s]" % kwargs.get("delimeter", "\n\r"), encoding="UTF-8"))
#TODO do something with this monster?
self.cachedata = re.compile(kwargs.get("cachefilter",
self.cachedata = re.compile(bytes(kwargs.get("cachefilter",
"((?:\[31;01m\*|\[33;01m\*|"
"Bad Option|No space left|FATAL ERROR|SYNTAX:|mkisofs:|"
"error:|warning:|fatal:).*)"))
"error:|warning:|fatal:).*)"), encoding="UTF-8"))
self.atty = kwargs.get("atty", False)
self.alldata = ""
@ -1773,11 +1777,11 @@ class xattr():
if p.success():
return p.read()
err = p.readerr()
raise XAttrError(err.partition(b":")[2].strip())
raise XAttrError(err.partition(":")[2].strip())
@classmethod
def set(cls, dn, attrname, value):
p = process(cls.setfattr, "-n", attrname, "-v", value, dn)
if not p.success():
err = p.readerr()
raise XAttrError(err.rpartition(b":")[2].strip())
raise XAttrError(err.rpartition(":")[2].strip())

@ -132,7 +132,7 @@ class GPG():
if len(l.split(' ')) >= 12:
sig_data_ok = True
if not p.success() or not goodsig or not sig_data_ok:
if b"No public key" in p.readerr():
if "No public key" in p.readerr():
raise GPGNoKey(p.readerr())
else:
raise GPGError(p.readerr())

@ -446,7 +446,7 @@ class Fdisk(SizeableDisk, metaclass=ABCMeta):
self.fdisk.append("t\n%d\n%s\n" % (partnum, partid))
def search_errors(self, errors):
return re.search(rb"Value out of range[.]|: unknown command",
return re.search(r"Value out of range[.]|: unknown command",
errors)
def write(self):

@ -116,7 +116,7 @@ class Sizes(object):
if name.startswith('from_'):
return lambda x: x * getattr(Sizes, name[5:])
elif name.startswith('to_'):
return lambda x: x / getattr(Sizes, name[3:])
return lambda x: x // getattr(Sizes, name[3:])
else:
raise AttributeError
@ -124,7 +124,7 @@ class Sizes(object):
return count * getattr(Sizes, name)
def _to(self, name, count):
return count / getattr(Sizes, name)
return count // getattr(Sizes, name)
def imap_regexp(re_compiled, l, whole=False):
"""

Loading…
Cancel
Save