Get an accurate count for how many files are left that need unicode porting

555 left currently, sigh.
This commit is contained in:
Kovid Goyal 2019-05-27 20:32:09 +05:30
parent 2b5db3ba24
commit 6e0ec5b65c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -56,6 +56,8 @@ def run_2to3(path, show_diffs=False):
class Base(Command): class Base(Command):
scan_all_files = False
@property @property
def cache_file(self): def cache_file(self):
return self.j(build_cache_dir(), self.CACHE) return self.j(build_cache_dir(), self.CACHE)
@ -89,6 +91,14 @@ class Base(Command):
raise raise
dirty_files = tuple(f for f in self.get_files() if not self.is_cache_valid(f, cache)) dirty_files = tuple(f for f in self.get_files() if not self.is_cache_valid(f, cache))
try: try:
if self.scan_all_files:
bad_files = []
for f in dirty_files:
if self.file_has_errors(f):
bad_files.append(f)
else:
cache[f] = self.file_hash(f)
dirty_files = bad_files
for i, f in enumerate(dirty_files): for i, f in enumerate(dirty_files):
num_left = len(dirty_files) - i - 1 num_left = len(dirty_files) - i - 1
self.info('\tChecking', f) self.info('\tChecking', f)
@ -141,6 +151,7 @@ class UnicodeCheck(Base):
description = 'Check for unicode porting status' description = 'Check for unicode porting status'
CACHE = 'check_unicode.json' CACHE = 'check_unicode.json'
scan_all_files = True
def get_error_statement(self, f): def get_error_statement(self, f):
uni_pat = re.compile(r'from __future__ import .*\bunicode_literals\b') uni_pat = re.compile(r'from __future__ import .*\bunicode_literals\b')