mirror of
https://github.com/facebook/sapling.git
synced 2024-10-12 09:48:05 +03:00
881e8a9831
Summary: Instead of relying on ctypes' default type guess being correct, let's provide the function signature of GetProcessTimes explicitly. This resolves an issue where the new interpreter raises `WindowsError: [Error 6] The handle is invalid.`. Reviewed By: ikostia Differential Revision: D15912516 fbshipit-source-id: 4fbb0de918d8a95ff665ae1b89494ed91e3fa8d3
26 lines
807 B
Python
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"],
|
|
)
|