Browse Source

Add variable os_linux_filesnum. For compatible with 3.0.

develop
Mike Hiretsky 10 years ago
parent
commit
fa0045eb2d
  1. 14
      pym/cl_utils.py
  2. 3
      pym/cl_vars.py

14
pym/cl_utils.py

@ -1445,3 +1445,17 @@ def tarLinks(rootpath,archpath,skip=[]):
removeDirs)
tar.close()
return links
def countFiles(dirpath,onefilesystem=True):
"""
Count files in dirpath
"""
num = 1
for dirpath,dirnames,filenames in os.walk(dirpath):
num += len(set(dirnames) | set(filenames))
if onefilesystem:
mountDirs = filter(lambda x:path.ismount(path.join(dirpath,x)),
dirnames)
for dirname in mountDirs:
dirnames.remove(dirname)
return num

3
pym/cl_vars.py

@ -127,6 +127,9 @@ class Data:
# system version
os_linux_build = {'hide':True}
# files number
os_linux_filesnum = {'hide':True}
# user login
ur_login = {'hide':True}

Loading…
Cancel
Save