本文整理汇总了Python中nuitka.Utils.normcase方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.normcase方法的具体用法?Python Utils.normcase怎么用?Python Utils.normcase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nuitka.Utils
的用法示例。
在下文中一共展示了Utils.normcase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: detectBinaryDLLs
# 需要导入模块: from nuitka import Utils [as 别名]
# 或者: from nuitka.Utils import normcase [as 别名]
def detectBinaryDLLs(binary_filename, package_name):
result = set()
if Utils.getOS() in ("Linux", "NetBSD"):
# Ask "ldd" about the libraries being used by the created binary, these
# are the ones that interest us.
process = subprocess.Popen(
args = [
"ldd",
binary_filename
],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE
)
stdout, _stderr = process.communicate()
for line in stdout.split(b"\n"):
if not line:
continue
if b"=>" not in line:
continue
part = line.split(b" => ", 2)[1]
if b"(" in part:
filename = part[:part.rfind(b"(")-1]
else:
filename = part
if not filename:
continue
if Utils.python_version >= 300:
filename = filename.decode("utf-8")
result.add(filename)
elif Utils.getOS() == "Windows":
depends_exe = getDependsExePath()
env = os.environ.copy()
path = env.get("PATH","").split(";")
path += sys.path
if package_name is not None:
for element in sys.path:
candidate = Utils.joinpath(element, package_name)
if Utils.isDir(candidate):
path.append(candidate)
env["PATH"] = ";".join(path)
subprocess.call(
(
depends_exe,
"-c",
"-ot%s" % binary_filename + ".depends",
"-f1",
"-pa1",
"-ps1",
binary_filename
),
env = env,
)
inside = False
for line in open(binary_filename + ".depends"):
if "| Module Dependency Tree |" in line:
inside = True
continue
if not inside:
continue
if "| Module List |" in line:
break
if "]" not in line:
continue
# Skip missing DLLs, apparently not needed anyway.
if "?" in line[:line.find("]")]:
continue
dll_filename = line[line.find("]")+2:-1]
assert Utils.isFile(dll_filename), dll_filename
# The executable itself is of course excempted.
if Utils.normcase(dll_filename) == \
Utils.normcase(Utils.abspath(binary_filename)):
continue
dll_name = Utils.basename(dll_filename).upper()
# Win API can be assumed.
if dll_name.startswith("API-MS-WIN-") or dll_name.startswith("EXT-MS-WIN-"):
#.........这里部分代码省略.........