fix_bytes: loosen blacklist matching requirements
On my Linux machine, paths seen by 2to3 include the build directory. We
switch from an exact to substring match to allow 2to3 to work in more
environments.
--- a/contrib/hgfixes/fix_bytes.py Mon May 19 22:12:31 2014 +0200
+++ b/contrib/hgfixes/fix_bytes.py Sat May 10 14:54:39 2014 -0700
@@ -12,10 +12,10 @@
# XXX: Implementing a blacklist in 2to3 turned out to be more troublesome than
# blacklisting some modules inside the fixers. So, this is what I came with.
-blacklist = ['mercurial/demandimport.py',
+blacklist = ('mercurial/demandimport.py',
'mercurial/py3kcompat.py', # valid python 3 already
'mercurial/i18n.py',
- ]
+ )
def isdocstring(node):
def isclassorfunction(ancestor):
@@ -83,7 +83,8 @@
PATTERN = 'STRING'
def transform(self, node, results):
- if self.filename in blacklist:
+ # The filename may be prefixed with a build directory.
+ if self.filename.endswith(blacklist):
return
if node.type == token.STRING:
if _re.match(node.value):