本文整理汇总了Python中fbuild.path.Path.getcwd方法的典型用法代码示例。如果您正苦于以下问题:Python Path.getcwd方法的具体用法?Python Path.getcwd怎么用?Python Path.getcwd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fbuild.path.Path
的用法示例。
在下文中一共展示了Path.getcwd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: f
# 需要导入模块: from fbuild.path import Path [as 别名]
# 或者: from fbuild.path.Path import getcwd [as 别名]
def f(module, include):
# On case-insensitive but case-preserving filesystems, we need to
# be careful on how we deal with finding OCaml dependencies. Since
# OCaml can store a module named List in either list.ml or List.ml,
# we can't just test if the filename exists since fbuild needs to
# deal with the exact filenames. To do that, we'll grab the list
# of filenames in the directory, then search for the right
# spelling in that list.
# Grab the filenames in the directory.
if include is None:
dirs = Path.getcwd().listdir()
else:
include = Path(include)
if not include.exists():
# We can't search for dependencies in a directory that
# doesn't exist, so exit early.
return False
dirs = include.listdir()
found = False
for suffix in '.mli', '.ml':
# Look for the traditional lowercase form.
path = module[0].lower() + module[1:] + suffix
if path not in dirs:
# That didn't work, so lets try the uppercase form.
path = module[0].upper() + module[1:] + suffix
if path not in dirs:
# Couldn't find it, so just skip this module.
continue
# We found it! Add that file to the dependencies.
if include is None:
deps.append(Path(path))
else:
deps.append(include / path)
found = True
return found