本文整理汇总了Python中misc.filetool.findYoungest函数的典型用法代码示例。如果您正苦于以下问题:Python findYoungest函数的具体用法?Python findYoungest怎么用?Python findYoungest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findYoungest函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: mostRecentlyChangedFile
def mostRecentlyChangedFile(self, force=False):
if self.__youngest != (None,None) and not force:
return self.__youngest
youngFiles = {} # {timestamp: "filepath"}
# also check the Manifest file
file_, mtime = filetool.findYoungest(self.manipath)
youngFiles[mtime] = file_
# for each interesting library part
for category in self.assets:
catsuffix = self.assets[category]['path']
if catsuffix is None: # if this changed recently, the Manifest reflects it
continue
if not os.path.isdir(os.path.join(self.path, catsuffix)):
# this might be a recent change reflected in the parent dirs
for sepIdx in [0] + [mo.start() for mo in re.finditer("/", catsuffix)]: # check self.path, self.path + "/foo", self.path + "/foo/bar", ...
pardir = os.path.join(self.path, catsuffix[:sepIdx])
if not os.path.isdir(pardir):
break
else:
mtime = os.stat(pardir).st_mtime
youngFiles[mtime] = pardir
else:
catPath = os.path.join(self.path, catsuffix)
# find youngest file
file_, mtime = filetool.findYoungest(catPath)
youngFiles[mtime] = file_
# and return the maximum of those
youngest = sorted(youngFiles.keys())[-1]
self.__youngest = (youngFiles[youngest], youngest) # ("filepath", mtime)
return self.__youngest
开发者ID:b-long,项目名称:first-qooxdo-app,代码行数:34,代码来源:Library.py
示例2: check
def check(self, since):
ylist = []
for path in self.paths:
self.console.debug("checking path '%s'" % path)
part_list = filetool.findYoungest(path, pattern=self.pattern,
includedirs=self.with_dirs, since=since)
ylist.extend(part_list)
return ylist
开发者ID:Amsoft-Systems,项目名称:qooxdoo,代码行数:8,代码来源:ActionLib.py
示例3: mostRecentlyChangedFile
def mostRecentlyChangedFile(self):
youngFiles = {}
# for each interesting library part
for category in self.categories:
catPath = self.categories[category]["path"]
if category == "translation" and not os.path.isdir(catPath):
continue
# find youngest file
file, mtime = filetool.findYoungest(catPath)
youngFiles[mtime] = file
# also check the Manifest file
file, mtime = filetool.findYoungest(self.manifest)
youngFiles[mtime] = file
# and return the maximum of those
youngest = sorted(youngFiles.keys())[-1]
return (youngFiles[youngest], youngest)
开发者ID:salmon-charles,项目名称:qooxdoo-build-tool,代码行数:19,代码来源:Library.py
示例4: _checkToolsNewer_1
def _checkToolsNewer_1(self, path, checkFile, context):
if not os.path.isfile(checkFile):
return True
checkFileMTime = os.stat(checkFile).st_mtime
# find youngst tool file
_, toolCheckMTime = filetool.findYoungest(os.path.dirname(filetool.root()))
# compare
if checkFileMTime < toolCheckMTime:
return True
else:
return False
开发者ID:reneolivo,项目名称:qooxdoo,代码行数:11,代码来源:Cache.py
示例5: watch
def watch(self, jobconf, confObj):
console = Context.console
since = time.time()
interval = jobconf.get("watch-files/interval", 2)
paths = jobconf.get("watch-files/paths", [])
if not paths:
return
include_dirs = jobconf.get("watch-files/include-dirs", False)
exit_on_retcode = jobconf.get("watch-files/exit-on-retcode", False)
command = jobconf.get("watch-files/command/line", "")
if not command:
return
command_tmpl = CommandLineTemplate(command)
per_file = jobconf.get("watch-files/command/per-file", False)
console.info("Watching changes of '%s'..." % paths)
console.info("Press Ctrl-C to terminate.")
pattern = self._watch_pattern(jobconf.get("watch-files/include",[]))
while True:
time.sleep(interval)
ylist = []
for path in paths:
console.debug("checking path '%s'" % path)
part_list = filetool.findYoungest(path, pattern=pattern, includedirs=include_dirs, since=since)
ylist.extend(part_list)
since = time.time()
if ylist: # ylist =[(fpath,fstamp)]
flist = [f[0] for f in ylist]
cmd_args = {'FILELIST': ' '.join(flist)}
console.debug("found changed files: %s" % flist)
try:
if not per_file:
cmd = command_tmpl.safe_substitute(cmd_args)
self.runShellCommand(cmd)
else:
for fname in flist:
cmd_args['FILE'] = fname # foo/bar/baz.js
cmd_args['DIRNAME'] = os.path.dirname(fname) # foo/bar
cmd_args['BASENAME'] = os.path.basename(fname) # baz.js
cmd_args['EXTENSION'] = os.path.splitext(fname)[1] # .js
cmd_args['FILENAME'] = os.path.basename(os.path.splitext(fname)[0]) # baz
cmd = command_tmpl.safe_substitute(cmd_args)
self.runShellCommand(cmd)
except RuntimeError:
if exit_on_retcode:
raise
else:
pass
return
开发者ID:6r1d,项目名称:qooxdoo,代码行数:48,代码来源:ActionLib.py
注:本文中的misc.filetool.findYoungest函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论