Skip to content

Commit

Permalink
Support Unicode filenames in Python 2
Browse files Browse the repository at this point in the history
This is related to #79.
  • Loading branch information
myint committed Nov 23, 2015
1 parent 4563008 commit 793bd44
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cppclean
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ from cpp import tokenize
from cpp import utils


try:
unicode
except NameError:
unicode = str


def match_file(filename, exclude_patterns):
"""Return True if file is a C++ file or a directory."""
base_name = os.path.basename(filename)
Expand Down Expand Up @@ -96,6 +102,9 @@ def main():
help='ignore parse errors')
args = parser.parse_args()

# For Python 2 where argparse does not return Unicode.
args.files = [unicode(filename) for filename in args.files]

status = 0
for filename in (
sorted(find_files(args.files,
Expand Down

0 comments on commit 793bd44

Please sign in to comment.