本文整理汇总了Python中nuitka.Utils.normpath方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.normpath方法的具体用法?Python Utils.normpath怎么用?Python Utils.normpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nuitka.Utils
的用法示例。
在下文中一共展示了Utils.normpath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _consider
# 需要导入模块: from nuitka import Utils [as 别名]
# 或者: from nuitka.Utils import normpath [as 别名]
def _consider( self, constraint_collection, module_filename, module_package ):
assert module_package is None or ( type( module_package ) is str and module_package != "" )
module_filename = Utils.normpath( module_filename )
if Utils.isDir( module_filename ):
module_name = Utils.basename( module_filename )
elif module_filename.endswith( ".py" ):
module_name = Utils.basename( module_filename )[:-3]
else:
module_name = None
if module_name is not None:
decision = self._decide( module_filename, module_name, module_package )
if decision:
module_relpath = Utils.relpath( module_filename )
return self._recurseTo(
constraint_collection = constraint_collection,
module_package = module_package,
module_filename = module_filename,
module_relpath = module_relpath
)
elif decision is None:
if module_package is None:
module_fullpath = module_name
else:
module_fullpath = module_package + "." + module_name
if module_filename not in self._warned_about:
self._warned_about.add( module_filename )
warning( # long message, but shall be like it, pylint: disable=C0301
"""\
Not recursing to '%(full_path)s' (%(filename)s), please specify \
--recurse-none (do not warn), \
--recurse-all (recurse to all), \
--recurse-not-to=%(full_path)s (ignore it), \
--recurse-to=%(full_path)s (recurse to it) to change.""" % {
"full_path" : module_fullpath,
"filename" : module_filename
}
)
示例2: considerFilename
# 需要导入模块: from nuitka import Utils [as 别名]
# 或者: from nuitka.Utils import normpath [as 别名]
def considerFilename( module_filename, module_package ):
assert module_package is None or ( type( module_package ) is str and module_package != "" )
module_filename = Utils.normpath( module_filename )
if Utils.isDir( module_filename ):
module_filename = Utils.abspath( module_filename )
module_name = Utils.basename( module_filename )
module_relpath = Utils.relpath( module_filename )
return module_filename, module_relpath, module_name
elif module_filename.endswith( ".py" ):
module_name = Utils.basename( module_filename )[:-3]
module_relpath = Utils.relpath( module_filename )
return module_filename, module_relpath, module_name
else:
return None
示例3: _consider
# 需要导入模块: from nuitka import Utils [as 别名]
# 或者: from nuitka.Utils import normpath [as 别名]
def _consider(self, constraint_collection, module_filename, module_package):
assert module_package is None or \
(type(module_package) is str and module_package != "")
module_filename = Utils.normpath(module_filename)
if Utils.isDir(module_filename):
module_name = Utils.basename(module_filename)
module_kind = "py"
elif module_filename.endswith(".py"):
module_name = Utils.basename(module_filename)[:-3]
module_kind = "py"
elif module_filename.endswith(".so"):
module_kind = "shlib"
module_name = Utils.basename(module_filename)[:-3]
elif module_filename.endswith(".pyd"):
module_kind = "shlib"
module_name = Utils.basename(module_filename)[:-4]
else:
module_kind = None
module_name = None
if module_kind is not None:
from nuitka.tree import Recursion
decision, reason = Recursion.decideRecursion(
module_filename = module_filename,
module_name = module_name,
module_package = module_package,
module_kind = module_kind
)
if decision:
module_relpath = Utils.relpath(module_filename)
imported_module, added_flag = Recursion.recurseTo(
module_package = module_package,
module_filename = module_filename,
module_relpath = module_relpath,
module_kind = module_kind,
reason = reason
)
if added_flag:
constraint_collection.signalChange(
"new_code",
imported_module.getSourceReference(),
"Recursed to module."
)
return imported_module
elif decision is None and module_kind == "py":
if module_package is None:
module_fullpath = module_name
else:
module_fullpath = module_package + "." + module_name
if module_filename not in self._warned_about and \
module_fullpath not in getModuleWhiteList():
self._warned_about.add(module_filename)
warning(
"""\
Not recursing to '%(full_path)s' (%(filename)s), please specify \
--recurse-none (do not warn), \
--recurse-all (recurse to all), \
--recurse-not-to=%(full_path)s (ignore it), \
--recurse-to=%(full_path)s (recurse to it) to change.""" % {
"full_path" : module_fullpath,
"filename" : module_filename
}
)