From ac8d2bcaee2f9636271bd5e07d699015e54d347d Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Wed, 7 Feb 2018 17:21:16 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D1=8B?= =?UTF-8?q?=20slave=20=D1=81=D0=B5=D1=82=D0=B5=D0=B2=D1=8B=D0=B5=20=D1=83?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=B9=D1=81=D1=82=D0=B2=D0=B0=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/calculate/lib/utils/ip.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pym/calculate/lib/utils/ip.py b/pym/calculate/lib/utils/ip.py index 13e5b11..86f75c6 100644 --- a/pym/calculate/lib/utils/ip.py +++ b/pym/calculate/lib/utils/ip.py @@ -246,6 +246,9 @@ def getInterfaces(): return False if device.sysfs.exists(x, "bonding_slave"): return False + # exclude slave devices + if any(device.sysfs.glob(x, "lower_*")): + return False return True return sorted(path.basename(x) From 9a74354a712881daaabe56d62941123e1433dce0 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Tue, 20 Feb 2018 16:58:29 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20mode=20=D0=B8=20owner=20=D1=83=20=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20=D0=BF=D1=80=D0=B8=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B8=20.=5Fcfg0000?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/calculate/lib/cl_template.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pym/calculate/lib/cl_template.py b/pym/calculate/lib/cl_template.py index 70c5c74..bf6a9f3 100644 --- a/pym/calculate/lib/cl_template.py +++ b/pym/calculate/lib/cl_template.py @@ -1596,6 +1596,7 @@ class _file(_error): self.nameFileConfig = os.path.abspath(nameFileConfig) self.nameFileTemplate = os.path.abspath(nameFileTemplate) self.F_TEMPL = self.openTemplFile(self.nameFileTemplate) + copy_stat = not os.path.exists(self.nameFileConfig) if (not self.executeType and typeFormat not in HParams.Formats.Executable): self.F_CONF = self.__openConfFile(self.nameFileConfig) @@ -1606,11 +1607,25 @@ class _file(_error): self.nameFileConfig) if newBuffer is None: self.textConfig = readFile(origConfigName) + if copy_stat: + self.copy_mod_own(origConfigName, self.nameFileConfig) else: self.textConfig = newBuffer else: self.textConfig = self.F_CONF.read() + def copy_mod_own(self, source, target): + try: + statdata = os.stat(source) + statdata_old = os.stat(target) + if statdata.st_mode != statdata_old.st_mode: + os.chmod(target, statdata.st_mode) + if (statdata.st_uid != statdata_old.st_uid or + statdata.st_gid != statdata_old.st_gid): + os.chown(target, statdata.st_uid, statdata.st_gid) + except OSError: + pass + def __del__(self): self.closeFiles() @@ -4578,6 +4593,7 @@ gettext -d cl_template "$*" try: open(filename, 'w').write( readFile(cfgs[filename][0][1])) + self.copy_mod_own(cfgs[filename][0][1], filename) except Exception as e: self.printERROR(str(e)) self.printWARNING( From f74753f57238ce139f13a7803c3b122ae5602ad8 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Wed, 28 Feb 2018 16:47:27 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80=D0=B6=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=D0=B0=20LinuxTerminal?= =?UTF-8?q?=20=D1=81=20custom=20esc-=D1=81=D0=B8=D0=BC=D0=B2=D0=BE=D0=BB?= =?UTF-8?q?=D0=BE=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pym/calculate/lib/utils/colortext/output.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pym/calculate/lib/utils/colortext/output.py b/pym/calculate/lib/utils/colortext/output.py index 0a4265f..f12de32 100644 --- a/pym/calculate/lib/utils/colortext/output.py +++ b/pym/calculate/lib/utils/colortext/output.py @@ -227,6 +227,13 @@ class ColorTerminalOutput(SaveAttrOutput): mapBackgroundColors = ConsoleCodeMapping(ConsoleCodesInfo.BACKGROUND, BaseColorMapping) + def __init__(self, state=None, escSymb=None): + SaveAttrOutput.__init__(self, state=state) + if escSymb is None: + self.escSymb = '\033' + else: + self.escSymb = escSymb + def setBold(self): self.resetHalfbright() super(ColorTerminalOutput, self).setBold() @@ -319,7 +326,7 @@ class ColorTerminalOutput(SaveAttrOutput): """ Создать ESC строку """ - attrs = map(str, ['\033['] + attrs + ['m']) + attrs = map(str, ['%s[' % self.escSymb] + attrs + ['m']) return "%s%s%s" % (attrs[0], ";".join(attrs[1:-1]), attrs[-1]) def outputText(self, s): @@ -392,8 +399,8 @@ class ColorTerminal16Output(ColorTerminalOutput): После преобразования текст и фон могут одинакового цвета """ - def __init__(self, state=None, palette=None): - SaveAttrOutput.__init__(self, state=state) + def __init__(self, state=None, palette=None, escSymb=None): + ColorTerminalOutput.__init__(self, state=state, escSymb=escSymb) self.palette = palette def _handleNearestColors(self, color):