Closed cclauss closed 5 years ago
flake8 testing of https://github.com/o-lim/generate-ninja on Python 3.7.0
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
./build/download_nacl_toolchains.py:26:27: E999 SyntaxError: invalid syntax print "Can't find '%s'" % package_version ^ ./build/gyp_chromium.py:59:45: E999 SyntaxError: invalid syntax print 'Updating projects from gyp files...' ^ ./build/run_swarming_xcode_install.py:42:27: E999 SyntaxError: invalid syntax print 'Making isolate.' ^ ./build/detect_host_arch.py:47:14: E999 SyntaxError: invalid syntax print DoMain([]) ^ ./build/package_mac_toolchain.py:95:30: E999 SyntaxError: invalid syntax print "Invalid Xcode dir." ^ ./build/check_return_value.py:15:9: E999 SyntaxError: invalid syntax print 1 ^ ./build/copy_test_data_ios.py:97:41: E999 SyntaxError: invalid syntax except WrongNumberOfArgumentsException, e: ^ ./build/gn_run_binary.py:24:37: E999 SyntaxError: invalid syntax print '%s failed with exit code %d' % (sys.argv[1], ret) ^ ./build/fix_gn_headers.py:42:16: E999 SyntaxError: invalid syntax print ' ', gnfile, linenr, new ^ ./build/symlink.py:43:19: E999 SyntaxError: invalid syntax except OSError, e: ^ ./build/mac_toolchain.py:100:38: E999 SyntaxError: invalid syntax print 'Downloading new toolchain.' ^ ./build/win_is_xtree_patched.py:26:14: E999 SyntaxError: invalid syntax print DoMain([]) ^ ./build/get_syzygy_binaries.py:93:24: F821 undefined name 'basestring' if not isinstance(r, basestring) or not _REVISION_RE.match(r): ^ ./build/get_syzygy_binaries.py:101:32: F821 undefined name 'basestring' if not isinstance(relpath, basestring) or len(relpath) == 0: ^ ./build/get_syzygy_binaries.py:104:28: F821 undefined name 'basestring' if not isinstance(md5, basestring) or not _MD5_RE.match(md5): ^ ./build/gypi_to_gn.py:103:21: E999 SyntaxError: invalid syntax except SyntaxError, e: ^ ./build/landmine_utils.py:23:26: E999 SyntaxError: invalid syntax print '%s -> %r' % (func.__name__, val[0]) ^ ./build/apply_locales.py:23:50: E999 SyntaxError: invalid syntax print 'ERROR: need string and list of locales' ^ ./build/protoc_java.py:40:64: E999 SyntaxError: invalid syntax print 'One of --java-out-dir or --srcjar must be specified.' ^ ./build/check_gn_headers.py:155:11: E999 SyntaxError: invalid syntax print e ^ ./build/get_landmines.py:43:68: E999 SyntaxError: invalid syntax print 'Need to clobber winja goma due to backend cwd cache fix.' ^ ./build/find_depot_tools.py:68:24: E999 SyntaxError: invalid syntax print DEPOT_TOOLS_PATH ^ ./build/landmines.py:53:13: F821 undefined name 'Error' raise Error('CHROMIUM_OUT_DIR environment variable is set but blank!') ^ ./build/gyp_helper.py:22:21: E999 SyntaxError: invalid syntax except SyntaxError, e: ^ ./build/vs_toolchain.py:137:33: E999 SyntaxError: invalid syntax print 'Copying %s to %s...' % (source, target) ^ ./build/extract_from_cab.py:20:13: E999 SyntaxError: invalid syntax print out ^ ./build/swarming_xcode_install.py:33:40: E999 SyntaxError: invalid syntax print "Xcode %s already installed" % VERSION ^ ./build/gn_helpers.py:32:24: F821 undefined name 'basestring' if isinstance(value, basestring): ^ ./build/gn_helpers.py:39:24: F821 undefined name 'unicode' if isinstance(value, unicode): ^ ./build/gn_helpers.py:55:30: F821 undefined name 'basestring' if not isinstance(key, basestring): ^ ./build/toolchain/get_concurrent_links.py:72:34: E999 SyntaxError: invalid syntax print _GetDefaultConcurrentLinks(options.mem_per_link_gb, ^ ./build/toolchain/win/midl.py:208:18: E999 SyntaxError: invalid syntax print line ^ ./build/toolchain/win/setup_toolchain.py:181:23: E999 SyntaxError: invalid syntax print 'vc_bin_dir = ' + gn_helpers.ToGNString(vc_bin_dir) ^ ./build/toolchain/win/tool_wrapper.py:145:18: E999 SyntaxError: invalid syntax print line, ^ ./build/toolchain/mac/get_tool_mtime.py:17:19: E999 SyntaxError: invalid syntax print '%s = %d' % (variable, os.path.getmtime(f)) ./build/toolchain/mac/linker_driver.py:55:12: F821 undefined name 'xrange' for i in xrange(len(args)): ^ ./build/fuchsia/update_sdk.py:25:33: E999 SyntaxError: invalid syntax print 'Creating directory %s' % path ^ ./build/fuchsia/test_runner.py:213:29: E999 SyntaxError: invalid syntax print 'Filter file is %s' % (args.test_launcher_filter_file if ^ ./build/fuchsia/exe_runner.py:53:36: E999 SyntaxError: invalid syntax print 'Invalid --extra-file: ', extra_file ^ ./build/fuchsia/create_runner_script.py:105:40: E999 SyntaxError: invalid token os.chmod(args.script_output_path, 0750) ^ ./build/fuchsia/runner_common.py:44:16: E999 SyntaxError: invalid syntax print 'Run:', ' '.join(args) ^ ./build/config/get_host_byteorder.py:11:9: E999 SyntaxError: invalid syntax print sys.byteorder ^ ./build/config/ios/write_framework_hmap.py:50:59: E999 SyntaxError: invalid syntax max_value_length = len(max(filelist.items(), key=lambda (k,v):len(v))[1]) ^ ./build/config/ios/find_signing_identity.py:47:18: E999 SyntaxError: invalid syntax print identity ^ ./build/config/linux/pkg-config.py:57:71: E999 SyntaxError: invalid syntax print "You must specify an architecture via -a if using a sysroot." ^ ./build/config/mac/prepare_framework_version.py:34:29: E999 SyntaxError: invalid token os.makedirs(dirname, 0700) ^ ./build/config/mac/package_framework.py:26:76: E999 SyntaxError: invalid token os.makedirs(os.path.join(args.framework, VERSIONS, args.version), 0744) ^ ./build/config/mac/sdk_info.py:77:17: E999 SyntaxError: invalid syntax print '%s=%s' % (key, value) ^ ./build/config/posix/sysroot_ld_path.py:15:28: E999 SyntaxError: invalid syntax print "Need two arguments" ^ ./build/win/use_ansi_codes.py:10:15: E999 SyntaxError: invalid syntax print 'ANSICON' in os.environ ^ ./build/win/copy_cdb_to_output.py:41:33: E999 SyntaxError: invalid syntax print 'Copying %s to %s...' % (source, target) ^ ./build/win/message_compiler.py:124:62: E999 SyntaxError: invalid syntax print 'mc.exe output different from files in %s, see %s' % (source, ^ ./build/win/merge_pgc_files.py:82:14: E999 SyntaxError: invalid syntax print stdout ^ ./build/util/version.py:71:16: E999 SyntaxError: invalid syntax print repr(key), repr(val) ^ ./build/util/githead.py:25:13: E999 SyntaxError: invalid syntax print match.group(1) ^ ./build/util/lastchange.py:192:25: E999 SyntaxError: invalid syntax print revision_string ^ ./build/util/lib/common/perf_tests_results_helper.py:93:21: E999 SyntaxError: invalid syntax print 'Pages: [%s]' % ','.join([_EscapePerfResult(p) for p in page_list]) ^ ./build/util/lib/common/util.py:144:11: F821 undefined name 'socket' except (socket.gaierror, socket.error): ^ ./build/util/lib/common/util.py:144:28: F821 undefined name 'socket' except (socket.gaierror, socket.error): ^ ./build/util/lib/common/chrome_test_server_spawner.py:352:22: E999 SyntaxError: invalid syntax except ValueError, KeyError: ^ ./build/linux/install-chromeos-fonts.py:37:43: E999 SyntaxError: invalid syntax print "Error: %s must be run on Linux." % __file__ ^ ./build/linux/dump_app_syms.py:13:57: E999 SyntaxError: invalid syntax print "dump_app_syms.py <dump_syms_exe> <strip_binary>" ^ ./build/linux/rewrite_dirs.py:66:14: E999 SyntaxError: invalid syntax print line ^ ./build/linux/unbundle/remove_bundled_libraries.py:87:18: E999 SyntaxError: invalid syntax print path ^ ./build/linux/sysroot_scripts/build_and_upload.py:87:34: E999 SyntaxError: invalid syntax print "SYSROOT CREATION SUMMARY" ^ ./build/linux/sysroot_scripts/merge-package-lists.py:26:12: F821 undefined name 'xrange' for i in xrange(0, len(lines), 3): ^ ./build/linux/sysroot_scripts/install-sysroot.py:159:70: E999 SyntaxError: invalid syntax print 'You much specify either --arch, --all or --running-as-hook' ^ ./build/mac/tweak_info_plist.py:198:22: F821 undefined name 'xrange' for combination in xrange(0, combinations): ^ ./build/mac/tweak_info_plist.py:200:28: F821 undefined name 'xrange' for component_index in xrange(0, components_len): ^ ./build/mac/find_sdk.py:80:20: E999 SyntaxError: invalid syntax print subprocess.check_output( ^ ./build/mac/should_use_hermetic_xcode.py:41:12: E999 SyntaxError: invalid syntax print main() ^ ./build/experimental/install-build-deps.py:380:14: E999 SyntaxError: invalid syntax print stderr ^ ./build/android/tombstones.py:158:40: F821 undefined name 'cmp' all_tombstones.sort(cmp=lambda a, b: cmp(b[1], a[1])) ^ ./build/android/lighttpd_server.py:107:29: E999 SyntaxError: invalid syntax print 'Client error:', client_error ^ ./build/android/generate_emma_html.py:64:34: E999 SyntaxError: invalid syntax print 'Found coverage files: %s' % str(coverage_files) ^ ./build/android/test_runner.py:851:22: F821 undefined name 'xrange' repetitions = (xrange(args.repeat + 1) if args.repeat >= 0 ^ ./build/android/findbugs_diff.py:100:13: E999 SyntaxError: invalid syntax print '*' * 80 ^ ./build/android/asan_symbolize.py:82:25: E999 SyntaxError: invalid syntax print asan_log_line['raw_log'] ^ ./build/android/update_verification.py:41:3: F821 undefined name 'raw_input' raw_input('Set the application state. Once ready, press enter and ' ^ ./build/android/update_verification.py:50:3: F821 undefined name 'raw_input' raw_input('Select "Restore my data" on the device. Then press enter to ' ^ ./build/android/apk_operations.py:178:17: E999 SyntaxError: invalid syntax print _Colorize( ^ ./build/android/adb_logcat_monitor.py:101:59: E999 SyntaxError: invalid syntax print 'adb_logcat_monitor: %s already exists? Cleaning' % base_dir ^ ./build/android/diff_resource_sizes.py:141:13: E999 SyntaxError: invalid syntax print e.output ^ ./build/android/resource_sizes.py:74:27: E999 SyntaxError: invalid syntax raise RuntimeError, "Corrupt extra field %s"%(ln,) ^ ./build/android/adb_command_line.py:65:34: E999 SyntaxError: invalid syntax print '%sCurrent flags (in %s):' % (action, args.name) ^ ./build/android/incremental_install/installer.py:100:31: F821 undefined name 'basestring' if isinstance(install_json, basestring): ^ ./build/android/gradle/generate_gradle.py:81:35: F821 undefined name 'basestring' if not isinstance(path_or_list, basestring): ^ ./build/android/gradle/gn_to_cmake.py:516:59: E999 SyntaxError: invalid syntax print 'Target {} has unknown target type {}, skipping.'.format( ^ ./build/android/gyp/create_apk_operations_script.py:79:40: E999 SyntaxError: invalid token os.chmod(args.script_output_path, 0750) ^ ./build/android/gyp/create_tool_wrapper.py:42:28: E999 SyntaxError: invalid token os.chmod(args.output, 0750) ^ ./build/android/gyp/generate_split_manifest.py:81:19: F821 undefined name 'file' main_manifest = file(options.main_manifest).read() ^ ./build/android/gyp/generate_split_manifest.py:87:8: F821 undefined name 'file' with file(options.out_manifest, 'w') as f: ^ ./build/android/gyp/create_stack_script.py:75:40: E999 SyntaxError: invalid token os.chmod(args.script_output_path, 0750) ^ ./build/android/gyp/lint.py:215:54: E999 SyntaxError: invalid syntax print 'Lint created unparseable xml file...' ^ ./build/android/gyp/java_cpp_enum.py:98:26: F821 undefined name 'basestring' if isinstance(v, basestring): ^ ./build/android/gyp/java_cpp_enum.py:121:22: F821 undefined name 'basestring' if isinstance(v, basestring): ^ ./build/android/gyp/find.py:27:16: E999 SyntaxError: invalid syntax print os.path.join(root, f) ^ ./build/android/gyp/assert_static_initializers.py:33:58: E999 SyntaxError: invalid syntax print 'Expected {} static initializers, but found {}.'.format( ^ ./build/android/gyp/create_java_binary_script.py:110:31: E999 SyntaxError: invalid token os.chmod(options.output, 0750) ^ ./build/android/gyp/create_test_runner_script.py:165:40: E999 SyntaxError: invalid token os.chmod(args.script_output_path, 0750) ^ ./build/android/gyp/util/md5_check.py:81:13: E999 SyntaxError: invalid syntax print '=' * 80 ^ ./build/android/gyp/util/build_utils.py:37:27: E999 SyntaxError: invalid token _HERMETIC_FILE_ATTR = (0644 << 16L) ^ ./build/android/pylib/valgrind_tools.py:214:48: E999 SyntaxError: invalid syntax print 'Unknown tool %s, available tools: %s' % ( ^ ./build/android/pylib/content_settings.py:26:26: F821 undefined name 'long' if isinstance(value, long): ^ ./build/android/pylib/perf/perf_test_instance.py:136:26: E999 SyntaxError: invalid syntax print output_formatted ^ ./build/android/pylib/results/presentation/standard_gtest_merge.py:132:12: F821 undefined name 'xrange' for i in xrange(max(len(left), len(right))): ^ ./build/android/pylib/results/presentation/test_results_presentation.py:461:29: E999 SyntaxError: invalid syntax print result_details_link ^ ./build/android/pylib/results/flakiness_dashboard/json_results_generator.py:304:21: E999 SyntaxError: invalid syntax except Exception, err: # pylint: disable=broad-except ^ ./build/android/pylib/utils/shared_preference_utils.py:26:25: F821 undefined name 'unicode' elif isinstance(data, unicode): ^ ./build/android/pylib/utils/shared_preference_utils.py:85:28: F821 undefined name 'basestring' elif isinstance(value, basestring): ^ ./build/android/pylib/utils/shared_preference_utils.py:87:28: F821 undefined name 'long' elif isinstance(value, long) or isinstance(value, int): ^ ./build/android/pylib/utils/findbugs.py:98:13: F821 undefined name 'cmp' return (cmp(self.error_type, other.error_type) ^ ./build/android/pylib/utils/findbugs.py:99:16: F821 undefined name 'cmp' or cmp(self.error_val, other.error_val)) ^ ./build/android/pylib/utils/findbugs.py:128:13: F821 undefined name 'cmp' return (cmp(self.file_name, other.file_name) ^ ./build/android/pylib/utils/findbugs.py:129:16: F821 undefined name 'cmp' or cmp(self.start_line, other.start_line) ^ ./build/android/pylib/utils/findbugs.py:130:16: F821 undefined name 'cmp' or cmp(self.end_line, other.end_line) ^ ./build/android/pylib/utils/findbugs.py:131:16: F821 undefined name 'cmp' or cmp(self.bug_type, other.bug_type) ^ ./build/android/pylib/utils/findbugs.py:132:16: F821 undefined name 'cmp' or cmp(self.message, other.message)) ^ ./build/android/pylib/utils/argparse_utils.py:45:14: E999 SyntaxError: invalid syntax print self._help_text ^ ./build/android/pylib/utils/emulator.py:206:12: F821 undefined name 'xrange' for n in xrange(emulator_count): ^ ./build/android/pylib/local/local_test_server_spawner.py:28:12: F821 undefined name 'xrange' for _ in xrange(1, max_attempts): ^ ./build/android/pylib/local/device/local_device_gtest_run.py:357:14: F821 undefined name 'xrange' for i in xrange(0, device_count): ^ ./build/android/pylib/local/device/local_device_gtest_run.py:360:27: F821 undefined name 'xrange' for j in xrange(0, len(unbounded_shard), _MAX_SHARD_SIZE)] ^ ./build/android/pylib/local/device/local_device_perf_test_run.py:194:12: F821 undefined name 'file' with file(pickled, 'r') as f: ^ ./build/android/pylib/local/device/local_device_perf_test_run.py:197:10: F821 undefined name 'file' with file(pickled, 'w') as f: ^ ./build/android/pylib/local/device/local_device_perf_test_run.py:366:12: F821 undefined name 'file' with file(self._test_instance.steps, 'r') as f: ^ ./build/android/pylib/local/device/local_device_instrumentation_test_run.py:105:14: F821 undefined name 'xrange' for _ in xrange(10): ^ ./build/android/pylib/symbols/deobfuscator.py:135:55: F821 undefined name 'xrange' self._pool = [Deobfuscator(mapping_path) for _ in xrange(pool_size)] ^ ./build/android/pylib/symbols/elf_symbolizer_unittest.py:58:17: F821 undefined name 'xrange' for addr in xrange(1000): ^ ./build/android/pylib/symbols/elf_symbolizer_unittest.py:128:17: F821 undefined name 'xrange' for addr in xrange(num_symbols): ^ ./build/android/pylib/symbols/elf_symbolizer_unittest.py:138:17: F821 undefined name 'xrange' for addr in xrange(num_symbols): ^ ./build/android/pylib/base/base_test_result.py:69:12: F821 undefined name 'cmp' return cmp(self._name, other._name) ^ ./build/android/pylib/linker/test_case.py:166:23: E999 SyntaxError: invalid syntax print '[ %-*s ] %s' % (margin, 'RUN', self.tagged_name) ^ ./build/android/play_services/update.py:427:24: E999 SyntaxError: invalid syntax print license_part ^ ./build/android/binary_size/apk_downloader.py:41:29: E999 SyntaxError: invalid syntax print '%s already exists' % apk_path ^ ./build/android/lint/suppress.py:52:20: E999 SyntaxError: invalid syntax print 'Parsing %s' % config_path ^ ./build/android/stacktrace/stackwalker.py:98:12: E999 SyntaxError: invalid syntax print line ^ ./build/android/stacktrace/java_deobfuscate_test.py:97:17: E999 SyntaxError: invalid syntax print 'Result:', 'PASS' if passed else 'FAIL' ^ ./testing/libfuzzer/coverage.py:126:12: F821 undefined name 'raw_input' answer = raw_input() ^ ./testing/libfuzzer/dictionary_generator.py:88:12: F821 undefined name 'xrange' for i in xrange(0, len(lines), 1): ^ ./base/android/jni_generator/jni_generator_tests.py:86:14: E999 SyntaxError: invalid syntax print self.id() ^ ./base/android/jni_generator/jni_registration_generator.py:57:24: E999 SyntaxError: invalid syntax print header_content ^ ./base/android/jni_generator/jni_generator.py:1253:20: E999 SyntaxError: invalid syntax except ParseError, e: ^ ./third_party/icu/source/test/depstest/depstest.py:46:39: E999 SyntaxError: invalid syntax print "Warning: duplicate .o file " + lib_obj_name ^ ./third_party/icu/source/tools/icu-svnprops-check.py:105:57: E999 SyntaxError: invalid syntax print "Bad line from autoprops definitions: " + propline ^ ./third_party/googletest/src/googlemock/scripts/upload.py:82:19: E999 SyntaxError: invalid syntax except IOError, e: ^ ./third_party/googletest/src/googlemock/scripts/fuse_gmock_files.py:235:17: E999 SyntaxError: invalid syntax print __doc__ ^ ./third_party/googletest/src/googletest/scripts/upload.py:82:19: E999 SyntaxError: invalid syntax except IOError, e: ^ ./third_party/googletest/src/googletest/scripts/release_docs.py:130:37: E999 SyntaxError: invalid syntax print 'Branching %d .wiki files:' % (len(self.files_to_branch),) ^ ./third_party/googletest/src/googletest/scripts/pump.py:249:37: E999 SyntaxError: invalid syntax print 'ERROR: %s expected at %s.' % (token_type, pos) ^ ./third_party/googletest/src/googletest/scripts/gen_gtest_pred_impl.py:306:32: E999 SyntaxError: invalid syntax print 'Updating file %s . . .' % path ^ ./third_party/googletest/src/googletest/xcode/Scripts/versiongenerate.py:57:56: E999 SyntaxError: invalid syntax print "Usage: versiongenerate.py input_dir output_dir" ^ ./third_party/libxml/src/check-relaxng-test-suite.py:79:44: E999 TabError: inconsistent use of tabs and spaces in indentation instance = instance + child.serialize() ^ ./third_party/libxml/src/check-xsddata-test-suite.py:67:44: E999 TabError: inconsistent use of tabs and spaces in indentation instance = instance + child.serialize() ^ ./third_party/libxml/src/check-xml-test-suite.py:34:42: E999 TabError: inconsistent use of tabs and spaces in indentation error_msg = error_msg + " >>" + str ^ ./third_party/libxml/src/genUnicode.py:46:36: E999 SyntaxError: invalid syntax print "Missing %s, aborting ..." % blockfile ^ ./third_party/libxml/src/regressions.py:77:54: E999 SyntaxError: invalid syntax print 'Length of expected is %d, result is %d' % (el, rl) ^ ./third_party/libxml/src/gentest.py:11:80: E999 SyntaxError: invalid syntax print "libxml2 python bindings not available, skipping testapi.c generation" ^ ./third_party/libxml/src/check-xinclude-test-suite.py:35:24: E999 TabError: inconsistent use of tabs and spaces in indentation error_nr = error_nr + 1 ^ ./third_party/libxml/src/check-relaxng-test-suite2.py:68:44: E999 TabError: inconsistent use of tabs and spaces in indentation ^ ./tools/gn/last_commit_position.py:91:36: E999 SyntaxError: invalid syntax print "Missing option '--outfile'" ^ ./tools/gn/bootstrap/bootstrap.py:72:76: E999 SyntaxError: invalid syntax print 'Building gn manually in a temporary directory for bootstrapping...' ^ ./tools/gn/bin/help_as_html.py:81:46: E999 SyntaxError: invalid syntax print 'usage: help_as_html.py <gn_binary>' ^ ./tools/gn/bin/compare_test_lists.py:67:14: E999 SyntaxError: invalid syntax print "\n", binary_name, "tests in", a_name, "but not", b_name ^ ./tools/gn/bin/gn-format.py:45:68: E999 SyntaxError: invalid syntax print 'Formatting failed, please report to gn-dev@chromium.org.' ^ 115 E999 SyntaxError: invalid syntax 50 F821 undefined name 'basestring' 165
Python scripts are now python 3 compatible, see d5b67aac
A bit more work required... https://travis-ci.org/o-lim/generate-ninja/jobs/528082764#L502
flake8 testing of https://github.com/o-lim/generate-ninja on Python 3.7.0
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics