import-checker: normalize directory separator to get module name on Windows
authorYuya Nishihara <yuya@tcha.org>
Sun, 27 Dec 2015 23:48:19 +0900
changeset 27620 0c60843b55b5
parent 27619 10bed65ef209
child 27621 39845b064041
import-checker: normalize directory separator to get module name on Windows It didn't work if a path contains "\\". Therefore, ctypes.util couldn't be found on Windows.
contrib/import-checker.py
--- a/contrib/import-checker.py	Sat Jan 02 11:47:07 2016 -0800
+++ b/contrib/import-checker.py	Sun Dec 27 23:48:19 2015 +0900
@@ -61,7 +61,7 @@
     >>> dotted_name_of_path('zlibmodule.so')
     'zlib'
     """
-    parts = path.split('/')
+    parts = path.replace(os.sep, '/').split('/')
     parts[-1] = parts[-1].split('.', 1)[0] # remove .py and .so and .ARCH.so
     if parts[-1].endswith('module'):
         parts[-1] = parts[-1][:-6]
@@ -180,7 +180,7 @@
     for m in ['msvcrt', '_winreg']:
         yield m
     # These get missed too
-    for m in 'ctypes', 'ctypes.util', 'email', 'logging', 'multiprocessing':
+    for m in 'ctypes', 'email', 'logging', 'multiprocessing':
         yield m
     yield 'builtins' # python3 only
     for m in 'fcntl', 'grp', 'pwd', 'termios':  # Unix only