Browse Source

py3 changes

py3_forced
idziubenko 10 months ago
parent
commit
89b8539539
  1. 6
      .gitignore
  2. 12
      data/check_domain_fastlogin
  3. 5
      data/setbg
  4. 18
      pym/desktop/desktop.py
  5. 4
      pym/desktop/variables/__init__.py
  6. 25
      pym/desktop/variables/desktop.py
  7. 6
      pym/desktop/wsdl_desktop.py
  8. 2
      setup.py

6
.gitignore

@ -0,0 +1,6 @@
revert_changes_to_vmachine
push_to_vmachine*
.vscode
*.pyc
*.pyo
*.bak

12
data/check_domain_fastlogin

@ -42,7 +42,7 @@ def get_git_fetchhead(gitpath):
def get_git_head_commit(gitpath):
headpath = os.path.join(gitpath, "HEAD")
head = read_file(headpath)
m = re.search("^ref: (refs/heads/.*)$", head, re.M)
m = re.search(r"^ref: (refs/heads/.*)$", head, re.M)
if m:
commitfile = os.path.join(gitpath, m.group(1))
return read_file(commitfile)
@ -73,11 +73,11 @@ def get_xorg_log_resolution():
with open(xlog, 'r') as f:
logdata = f.read()
for re_pat in (
"Output [\S]+ using initial mode (\d+)x(\d+)",
"Virtual screen size determined to be"
" ([0-9]+)\s*x\s*([0-9]+)",
'Setting mode "(\d+)x(\d+)[0-9@]"',
"Virtual size is (\d+)x(\d+)"):
r"Output [\S]+ using initial mode (\d+)x(\d+)",
r"Virtual screen size determined to be"
r" ([0-9]+)\s*x\s*([0-9]+)",
r'Setting mode "(\d+)x(\d+)[0-9@]"',
r"Virtual size is (\d+)x(\d+)"):
reXorgLogParser = re.compile(re_pat, re.S)
resXorgLogParser = reXorgLogParser.search(logdata)
if resXorgLogParser:

5
data/setbg

@ -39,8 +39,9 @@ class ImageViewer(QtGui.QMainWindow):
@staticmethod
def select_color():
try:
if filter(re.compile(r"(cld|cldx|cldg|cmc|cls)-themes-12").search,
os.listdir('/var/db/pkg/media-gfx')):
#TODO change for any in list compr?
if list(filter(re.compile(r"(cld|cldx|cldg|cmc|cls)-themes-12").search,
os.listdir('/var/db/pkg/media-gfx'))):
return "#73a363"
except OSError:
pass

18
pym/desktop/desktop.py

@ -164,7 +164,7 @@ class Desktop(MethodsInterface):
tf.close()
return True
def createUserDir(self, userName, uid, gid, userDir, mode=0700):
def createUserDir(self, userName, uid, gid, userDir, mode=0o700):
"""
Create user directory with need uid and gid
"""
@ -201,10 +201,10 @@ class Desktop(MethodsInterface):
mountProfileDir = path.join(dirStart, ".%s" % dirEnd)
mountRemoteProfileDir = path.join(dirStart, ".%s.remote" % dirEnd)
with open("/proc/mounts") as f:
return filter(lambda x: x.startswith(homeDir) or
return list(filter(lambda x: x.startswith(homeDir) or
x.startswith(mountProfileDir) or
x.startswith(mountRemoteProfileDir),
map(lambda x: x.split(" ")[1], f))
map(lambda x: x.split(" ")[1], f)))
def umountSleepPath(self, rpath):
"""
@ -335,17 +335,17 @@ class Desktop(MethodsInterface):
if uid:
uid = int(uid)
for i in range(0, postWaitTime):
if not filter(lambda x: "ksmserver" in x,
getRunCommands(uid=uid)):
if not list(filter(lambda x: "ksmserver" in x,
getRunCommands(uid=uid))):
break
time.sleep(1)
time.sleep(1)
if filter(lambda x: "xdm/xdm\x00--logout" in x,
getRunCommands()):
if list(filter(lambda x: "xdm/xdm\x00--logout" in x,
getRunCommands())):
for i in range(0, waitTime):
if not filter(lambda x: "xdm/xdm\x00--logout" in x,
getRunCommands()):
if not list(filter(lambda x: "xdm/xdm\x00--logout" in x,
getRunCommands())):
return True
time.sleep(1)
else:

4
pym/desktop/variables/__init__.py

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import action
import desktop
from . import action
from . import desktop
section = "desktop"

25
pym/desktop/variables/desktop.py

@ -59,9 +59,9 @@ class DomainInfoHelper(VariableInterface):
"""
def getUserDataInFile(self, login, filePasswd):
return filter(lambda x: x[0] == login,
return list(filter(lambda x: x[0] == login,
map(lambda x: x.strip().split(':'),
readLinesFile(filePasswd)))
readLinesFile(filePasswd))))
def isDomainUser(self, userName):
if userName:
@ -93,9 +93,9 @@ class VariableUrDomainSet(ReadonlyVariable, DomainInfoHelper):
type = "bool"
def getUserDataInFile(self, login, file_passwd):
return filter(lambda x: x[0] == login,
return list(filter(lambda x: x[0] == login,
map(lambda x: x.strip().split(':'),
readLinesFile(file_passwd)))
readLinesFile(file_passwd))))
def get(self):
return "on" if self.isDomainUser(self.Get('ur_login')) else "off"
@ -156,10 +156,10 @@ class VariableClDesktopGstData(ReadonlyVariable):
if res == gst.STATE_CHANGE_SUCCESS:
outdata['device_name'] = alsamixer.get_property("device-name")
outdata['long_name'] = alsamixer.get_factory().get_longname()
outdata['internal_name'] = filter(str.isalnum,
outdata['internal_name'] = list(filter(str.isalnum,
"%s (%s)" % (
outdata['device_name'],
outdata['long_name']))
outdata['long_name'])))
outdata['channels'] = []
for t in alsamixer.list_tracks():
if t.flags & gst.interfaces.MIXER_TRACK_OUTPUT:
@ -265,17 +265,17 @@ class VariableClDesktopOnlineData(ReadonlyTableVariable, DomainInfoHelper):
(x[2].startswith("(:") or
x[1].startswith(":")),
map(lambda x: listProcessing(
filter(lambda y: y, x.split())),
list(filter(lambda y: y, x.split()))),
resWho)))),
key=lambda x: x[0]),
lambda x: x[0])
xData = map(lambda x: (x[0][0], x[0][1],
xData = list(map(lambda x: (x[0][0], x[0][1],
self.get_user_uid(x[0][0]),
"on" if self.isDomainUser(
x[0][0]) else "off",
len(x)),
map(lambda x: list(x[1]),
xData))
xData)))
return xData
setValue = Variable.setValue
@ -461,11 +461,10 @@ class VariableClDesktopHashFace(Variable):
login = self.Get('ur_login')
icon_list = self.Get('cl_desktop_face_list')
if icon_list:
# return path.join(self.Get('cl_desktop_face_path'),
# icon_list[sum(map(lambda x: ord(x), hashlib.md5(login).digest())) % len(icon_list)])
return path.join(self.Get('cl_desktop_face_path'),
icon_list[sum(map(lambda x: ord(x),
hashlib.md5(
login).digest())) % len(
icon_list)])
icon_list[sum([x for x in hashlib.md5(login.encode("UTF-8")).digest()]) % len(icon_list)])
else:
return ""

6
pym/desktop/wsdl_desktop.py

@ -17,9 +17,9 @@ import sys
from calculate.lib.datavars import VariableError, DataVarsError
from calculate.core.server.func import WsdlBase
from desktop import DesktopError
from utils.cl_desktop import ClDesktopLogoutAction, ClDesktopAction
import desktop
from .desktop import DesktopError
from .utils.cl_desktop import ClDesktopLogoutAction, ClDesktopAction
from . import desktop
from calculate.lib.cl_lang import setLocalTranslate, getLazyLocalTranslate

2
setup.py

@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# setup.py --- Setup script for calculate-desktop

Loading…
Cancel
Save