[PATCH 1 of 2] import-checker: normalize directory separator to get module name on Windows
Gregory Szorc
gregory.szorc at gmail.com
Mon Jan 4 11:32:46 CST 2016
> On Jan 4, 2016, at 06:58, Yuya Nishihara <yuya at tcha.org> wrote:
>
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1451227699 -32400
> # Sun Dec 27 23:48:19 2015 +0900
> # Node ID 937c6a6dac98baaed78a5052890bc630e09b6848
> # Parent b8405d739149cdd6d8d9bd5e3dd2ad8487b1f09a
> import-checker: normalize directory separator to get module name on Windows
>
Series LGTM. Would queue if I could.
> It didn't work if a path contains "\\". Therefore, ctypes.util couldn't be
> found on Windows.
>
> diff --git a/contrib/import-checker.py b/contrib/import-checker.py
> --- a/contrib/import-checker.py
> +++ b/contrib/import-checker.py
> @@ -61,7 +61,7 @@ def dotted_name_of_path(path, trimpure=F
>>>> 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 @@ def list_stdlib_modules():
> 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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list