mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get an accurate count for how many files are left that need unicode porting
555 left currently, sigh.
This commit is contained in:
parent
2b5db3ba24
commit
6e0ec5b65c
@ -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')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user