[PATCH] windows: add win32com.shell to demandimport ignore list

Kostia Balytskyi ikostia at fb.com
Fri Apr 14 19:38:32 UTC 2017


# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1492198466 25200
#      Fri Apr 14 12:34:26 2017 -0700
# Node ID 8c3ee067eeb2337ea2a51ed0d707f599a3aaa4c6
# Parent  4c2c30bc38b4f84ce8f215146bbf158e299065b3
windows: add win32com.shell to demandimport ignore list

Module 'appdirs' tries to import win32com.shell (and catch ImportError as an
indication of failure) to check whether some further functionality should
be implemented one or another way [1]. Of course, demandimport lets it down, so
if we want appdirs to work we have to add it to demandimport's ignore list.

The reason we want appdirs to work is becuase it is used by setuptools [2] to
determine egg cache location. Only fairly recent versions of setuptools depend
on this so people don't see this often.


[1] https://github.com/ActiveState/appdirs/blob/master/appdirs.py#L560
[2] https://github.com/pypa/setuptools/blob/aae0a928119d2a178882c32bded02270e30d0273/pkg_resources/__init__.py#L1369

diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py
--- a/mercurial/demandimport.py
+++ b/mercurial/demandimport.py
@@ -274,6 +274,7 @@ ignore = [
     'fcntl',
     'nt', # pathlib2 tests the existence of built-in 'nt' module
     'win32com.gen_py',
+    'win32com.shell',
     '_winreg', # 2.7 mimetypes needs immediate ImportError
     'pythoncom',
     # imported by tarfile, not available under Windows


More information about the Mercurial-devel mailing list