Browse Source

Add variable os_linux_filesnum. For compatible with 3.0.

tags/2.2.29
Mike Hiretsky 9 years ago
parent
commit
fa0045eb2d
2 changed files with 17 additions and 0 deletions
  1. +14
    -0
      pym/cl_utils.py
  2. +3
    -0
      pym/cl_vars.py

+ 14
- 0
pym/cl_utils.py View File

@@ -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
- 0
pym/cl_vars.py View File

@@ -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