sapling/eden/scm/tests/test-check-win32-signature.py
Adam Simpkins ab3a7cb21f Move fb-mercurial sources into an eden/scm subdirectory.
Summary:
In preparation for merging fb-mercurial sources to the Eden repository,
move everything from the top-level directory into an `eden/scm`
subdirectory.
2019-11-13 16:04:48 -08:00

26 lines
807 B
Python

# Copyright 2019 Facebook, Inc.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import os
import re
def checkpath(path, dllnames):
content = open(path).read()
for name in dllnames:
for matched in sorted(set(re.findall(r"%s\.[^(.]*\(" % name, content))):
# remove tailing "("
funcname = matched[:-1]
for expected in ["%s.argtypes" % funcname, "%s.restype" % funcname]:
if expected not in content:
print("%s needs explicit argtypes and restype" % funcname)
break
checkpath(
"%s/../edenscm/mercurial/win32.py" % os.environ.get("RUNTESTDIR", "."),
["_kernel32", "_advapi32", "_user32", "_crypt32"],
)