diff --git a/cpplint/cpplint.py b/cpplint/cpplint.py index 53dbe81..8e07cab 100755 --- a/cpplint/cpplint.py +++ b/cpplint/cpplint.py @@ -52,6 +52,11 @@ import string import sys import unicodedata +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 + _USAGE = """ Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...] diff --git a/cpplint/cpplint_unittest.py b/cpplint/cpplint_unittest.py index 50d1d82..b3c7725 100755 --- a/cpplint/cpplint_unittest.py +++ b/cpplint/cpplint_unittest.py @@ -43,6 +43,11 @@ import unittest import cpplint +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 + # This class works as an error collector and replaces cpplint.Error # function for the unit tests. We also verify each category we see