# HG changeset patch # User Gregory Szorc # Date 1399758879 25200 # Node ID 48ef68004ec949e9da3b178a40cbaf6ab8039a48 # Parent 3de9f2c4900c58d196b74026f84e75cb619699be 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. diff -r 3de9f2c4900c -r 48ef68004ec9 contrib/hgfixes/fix_bytes.py --- 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):