[PATCH 2 of 3] fix_bytes: loosen blacklist matching requirements
Gregory Szorc
gregory.szorc at gmail.com
Sat May 10 18:39:56 CDT 2014
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1399758879 25200
# Sat May 10 14:54:39 2014 -0700
# Node ID 8a49e0cb7f14a69662da24d71ec2d4ab3f536df3
# Parent c59dd2bd4a28c4ce6438f15c9cfa612bb1e74162
fix_bytes: loosen blacklist matching requirements
diff --git a/contrib/hgfixes/fix_bytes.py b/contrib/hgfixes/fix_bytes.py
--- a/contrib/hgfixes/fix_bytes.py
+++ b/contrib/hgfixes/fix_bytes.py
@@ -11,12 +11,12 @@ from lib2to3.pygram import python_symbol
# 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):
symbols = (syms.funcdef, syms.classdef)
@@ -82,9 +82,10 @@ class FixBytes(fixer_base.BaseFix):
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):
if isdocstring(node):
More information about the Mercurial-devel
mailing list