changeset 21637:48ef68004ec9

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 10 May 2014 14:54:39 -0700
parents 3de9f2c4900c
children 5337cb17fa1f
files contrib/hgfixes/fix_bytes.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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):