haikuwebkit/Tools/Scripts/ensure-valid-python

72 lines
2.5 KiB
Plaintext
Raw Permalink Normal View History

Replace hard-coded paths in shebangs with #!/usr/bin/env https://bugs.webkit.org/show_bug.cgi?id=181040 Patch by Ting-Wei Lan <lantw44@gmail.com> on 2018-01-03 Reviewed by Alex Christensen. .: * Source/cmake/tools/scripts/auto-version.pl: * Source/cmake/tools/scripts/feature-defines.pl: * Source/cmake/tools/scripts/version-stamp.pl: Source/JavaScriptCore: * Scripts/UpdateContents.py: * Scripts/cssmin.py: * Scripts/generate-combined-inspector-json.py: * Scripts/xxd.pl: * create_hash_table: * generate-bytecode-files: * wasm/generateWasm.py: * wasm/generateWasmOpsHeader.py: * yarr/generateYarrCanonicalizeUnicode: Source/WebCore: * bindings/scripts/InFilesCompiler.pm: * bindings/scripts/InFilesParser.pm: * bindings/scripts/generate-bindings-all.pl: * bindings/scripts/generate-bindings.pl: * bindings/scripts/preprocess-idls.pl: * css/make-css-file-arrays.pl: * css/makeprop.pl: * css/makevalues.pl: * dom/make_event_factory.pl: * dom/make_names.pl: * extract-localizable-strings.pl: * make-hash-tools.pl: Source/WebCore/PAL: * AVFoundationSupport.py: Source/WebInspectorUI: * Scripts/combine-resources.pl: * Scripts/copy-user-interface-resources-dryrun.rb: * Scripts/copy-user-interface-resources.pl: * Scripts/fix-worker-imports-for-optimized-builds.pl: * Scripts/remove-console-asserts-dryrun.rb: * Scripts/remove-console-asserts.pl: * Scripts/update-LegacyInspectorBackendCommands.rb: * Scripts/update-codemirror-resources.rb: * WebInspectorUI.vcxproj/build-webinspectorui.pl: Source/WebKit: * Scripts/generate-forwarding-headers.pl: Source/WebKitLegacy: * scripts/generate-webkitversion.pl: Tools: * BuildSlaveSupport/build-launcher-app: * BuildSlaveSupport/build-launcher-dmg: * BuildSlaveSupport/build.webkit.org-config/steps_unittest.py: * BuildSlaveSupport/built-product-archive: * BuildSlaveSupport/clean-build: * BuildSlaveSupport/delete-stale-build-files: * BuildSlaveSupport/download-built-product: * BuildSlaveSupport/gtk/buildbot/log/run: * BuildSlaveSupport/gtk/buildbot/run: * BuildSlaveSupport/gtk/pulseaudio/run: * BuildSlaveSupport/kill-old-processes: * BuildSlaveSupport/test-result-archive: * BuildSlaveSupport/win/kill-old-processes: * Scripts/SpacingHeuristics.pm: * Scripts/add-include: * Scripts/build-api-tests: * Scripts/build-dumprendertree: * Scripts/build-imagediff: * Scripts/build-jsc: * Scripts/build-webkit: * Scripts/build-webkittestrunner: * Scripts/check-Xcode-source-file-types: * Scripts/check-dom-results: * Scripts/check-for-exit-time-destructors: * Scripts/check-for-global-initializers: * Scripts/check-for-inappropriate-objc-class-names: * Scripts/check-for-weak-vtables-and-externals: * Scripts/clean-header-guards: * Scripts/compare-timing-files: * Scripts/configure-xcode-for-ios-development: * Scripts/copy-webkitlibraries-to-product-directory: * Scripts/create-exports: * Scripts/debug-minibrowser: * Scripts/debug-safari: * Scripts/debug-test-runner: * Scripts/do-file-rename: * Scripts/do-webcore-rename: * Scripts/dump-webkit-tests-run: * Scripts/ensure-valid-python: * Scripts/execAppWithEnv: * Scripts/extract-localizable-js-strings: * Scripts/filter-build-webkit: * Scripts/find-extra-includes: * Scripts/fix-blink-patch: * Scripts/generate-coverage-data: * Scripts/git-add-reviewer: * Scripts/jsc-stress-test-helpers/js-exception-fuzz: * Scripts/jsc-stress-test-helpers/js-executable-allocation-fuzz: * Scripts/jsc-stress-test-helpers/js-osr-exit-fuzz: * Scripts/make-new-script-test: * Scripts/make-script-test-wrappers: * Scripts/package-root: * Scripts/parse-malloc-history: * Scripts/report-include-statistics: * Scripts/resolve-ChangeLogs: * Scripts/run-api-tests: * Scripts/run-bindings-tests: * Scripts/run-content-extension-tester: * Scripts/run-iexploder-tests: * Scripts/run-javascriptcore-tests: * Scripts/run-jsc: * Scripts/run-leaks: * Scripts/run-mangleme-tests: * Scripts/run-minibrowser: * Scripts/run-pageloadtest: * Scripts/run-regexp-tests: * Scripts/run-safari: * Scripts/run-sunspider: * Scripts/run-test-runner: * Scripts/run-webkit-app: * Scripts/run-webkit-httpd: * Scripts/run-webkit-websocketserver: * Scripts/set-webkit-configuration: * Scripts/show-pretty-diff: * Scripts/sort-Xcode-project-file: * Scripts/split-file-by-class: * Scripts/sunspider-compare-results: * Scripts/svn-apply: * Scripts/svn-unapply: * Scripts/test-webkit-scripts: * Scripts/test-webkitperl: * Scripts/update-iexploder-cssproperties: * Scripts/update-javascriptcore-test-results: * Scripts/update-webkit: * Scripts/update-webkit-auxiliary-libs: * Scripts/update-webkit-dependency: * Scripts/update-webkit-libs-jhbuild: * Scripts/update-webkit-localizable-strings: * Scripts/update-webkit-support-libs: * Scripts/update-webkitgtk-libs: * Scripts/update-webkitwpe-libs: * Scripts/webkit-build-directory: * Scripts/webkitperl/LoadAsModule.pm: * Scripts/webkitperl/VCSUtils_unittest/decodeGitBinaryPatch.pl: * Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatch.pl: * Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatchThenSetChangeLogDateAndReviewer.pl: * Scripts/webkitperl/VCSUtils_unittest/fixSVNPatchForAdditionWithHistory.pl: * Scripts/webkitperl/VCSUtils_unittest/generatePatchCommand.pl: * Scripts/webkitperl/VCSUtils_unittest/mergeChangeLogs.pl: * Scripts/webkitperl/VCSUtils_unittest/parseChunkRange.pl: * Scripts/webkitperl/VCSUtils_unittest/parseDiff.pl: * Scripts/webkitperl/VCSUtils_unittest/parseDiffHeader.pl: * Scripts/webkitperl/VCSUtils_unittest/parseDiffWithMockFiles.pl: * Scripts/webkitperl/VCSUtils_unittest/parseFirstEOL.pl: * Scripts/webkitperl/VCSUtils_unittest/parseGitDiffHeader.pl: * Scripts/webkitperl/VCSUtils_unittest/parsePatch.pl: * Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl: * Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffHeader.pl: * Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl: * Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl: * Scripts/webkitperl/VCSUtils_unittest/parseUnifiedDiffHeader.pl: * Scripts/webkitperl/VCSUtils_unittest/prepareParsedPatch.pl: * Scripts/webkitperl/VCSUtils_unittest/removeEOL.pl: * Scripts/webkitperl/VCSUtils_unittest/runCommand.pl: * Scripts/webkitperl/VCSUtils_unittest/runPatchCommand.pl: * Scripts/webkitperl/VCSUtils_unittest/setChangeLogDateAndReviewer.pl: * Scripts/webkitperl/auto-version_unittest/autoVersionTests.pl: * Scripts/webkitperl/auto-version_unittest/versionStampTests.pl: * Scripts/webkitperl/filter-build-webkit_unittest/shouldIgnoreLine_unittests.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/extractLineRangeBeforeAndAfterChange.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/fetchRadarURLFromBugXMLData.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/generateFunctionLists.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/parser_unittests.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/resources/perl_unittests.pl: * Scripts/webkitperl/run-leaks_unittest/run-leaks-report-v1.0.pl: * Scripts/webkitperl/run-leaks_unittest/run-leaks-report-v2.0-new.pl: * Scripts/webkitperl/run-leaks_unittest/run-leaks-report-v2.0-old.pl: * Scripts/webkitperl/webkitdirs_unittest/appendToEnvironmentVariableList.pl: * Scripts/webkitperl/webkitdirs_unittest/checkForArgumentAndRemoveFromArrayRef.pl: * Scripts/webkitperl/webkitdirs_unittest/checkForArgumentAndRemoveFromArrayRefGettingValue.pl: * Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl: * Scripts/webkitperl/webkitdirs_unittest/prependToEnvironmentVariableList.pl: * Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py: * ccache/ccache-clang: * ccache/ccache-clang++: * ccache/ccache-wrapper: * gtk/install-dependencies: * iExploder/iexploder-1.3.2/htdocs/iexploder.cgi: * iExploder/iexploder-1.3.2/htdocs/webserver.rb: * iExploder/iexploder-1.3.2/tools/lasthit.rb: * iExploder/iexploder-1.3.2/tools/osx_last_crash.rb: * iExploder/iexploder-1.3.2/tools/showtest.rb: * iExploder/iexploder-1.7.2/src/browser_harness.rb: * iExploder/iexploder-1.7.2/src/iexploder.cgi: * iExploder/iexploder-1.7.2/src/webserver.rb: * iExploder/iexploder-1.7.2/tools/lasthit.rb: * iExploder/iexploder-1.7.2/tools/osx_last_crash.rb: * wpe/install-dependencies: Canonical link: https://commits.webkit.org/197118@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226395 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-04 07:18:18 +00:00
#!/usr/bin/env perl
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of Apple Inc. ("Apple") nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
use strict;
Replace hard-coded paths in shebangs with #!/usr/bin/env https://bugs.webkit.org/show_bug.cgi?id=181040 Patch by Ting-Wei Lan <lantw44@gmail.com> on 2018-01-03 Reviewed by Alex Christensen. .: * Source/cmake/tools/scripts/auto-version.pl: * Source/cmake/tools/scripts/feature-defines.pl: * Source/cmake/tools/scripts/version-stamp.pl: Source/JavaScriptCore: * Scripts/UpdateContents.py: * Scripts/cssmin.py: * Scripts/generate-combined-inspector-json.py: * Scripts/xxd.pl: * create_hash_table: * generate-bytecode-files: * wasm/generateWasm.py: * wasm/generateWasmOpsHeader.py: * yarr/generateYarrCanonicalizeUnicode: Source/WebCore: * bindings/scripts/InFilesCompiler.pm: * bindings/scripts/InFilesParser.pm: * bindings/scripts/generate-bindings-all.pl: * bindings/scripts/generate-bindings.pl: * bindings/scripts/preprocess-idls.pl: * css/make-css-file-arrays.pl: * css/makeprop.pl: * css/makevalues.pl: * dom/make_event_factory.pl: * dom/make_names.pl: * extract-localizable-strings.pl: * make-hash-tools.pl: Source/WebCore/PAL: * AVFoundationSupport.py: Source/WebInspectorUI: * Scripts/combine-resources.pl: * Scripts/copy-user-interface-resources-dryrun.rb: * Scripts/copy-user-interface-resources.pl: * Scripts/fix-worker-imports-for-optimized-builds.pl: * Scripts/remove-console-asserts-dryrun.rb: * Scripts/remove-console-asserts.pl: * Scripts/update-LegacyInspectorBackendCommands.rb: * Scripts/update-codemirror-resources.rb: * WebInspectorUI.vcxproj/build-webinspectorui.pl: Source/WebKit: * Scripts/generate-forwarding-headers.pl: Source/WebKitLegacy: * scripts/generate-webkitversion.pl: Tools: * BuildSlaveSupport/build-launcher-app: * BuildSlaveSupport/build-launcher-dmg: * BuildSlaveSupport/build.webkit.org-config/steps_unittest.py: * BuildSlaveSupport/built-product-archive: * BuildSlaveSupport/clean-build: * BuildSlaveSupport/delete-stale-build-files: * BuildSlaveSupport/download-built-product: * BuildSlaveSupport/gtk/buildbot/log/run: * BuildSlaveSupport/gtk/buildbot/run: * BuildSlaveSupport/gtk/pulseaudio/run: * BuildSlaveSupport/kill-old-processes: * BuildSlaveSupport/test-result-archive: * BuildSlaveSupport/win/kill-old-processes: * Scripts/SpacingHeuristics.pm: * Scripts/add-include: * Scripts/build-api-tests: * Scripts/build-dumprendertree: * Scripts/build-imagediff: * Scripts/build-jsc: * Scripts/build-webkit: * Scripts/build-webkittestrunner: * Scripts/check-Xcode-source-file-types: * Scripts/check-dom-results: * Scripts/check-for-exit-time-destructors: * Scripts/check-for-global-initializers: * Scripts/check-for-inappropriate-objc-class-names: * Scripts/check-for-weak-vtables-and-externals: * Scripts/clean-header-guards: * Scripts/compare-timing-files: * Scripts/configure-xcode-for-ios-development: * Scripts/copy-webkitlibraries-to-product-directory: * Scripts/create-exports: * Scripts/debug-minibrowser: * Scripts/debug-safari: * Scripts/debug-test-runner: * Scripts/do-file-rename: * Scripts/do-webcore-rename: * Scripts/dump-webkit-tests-run: * Scripts/ensure-valid-python: * Scripts/execAppWithEnv: * Scripts/extract-localizable-js-strings: * Scripts/filter-build-webkit: * Scripts/find-extra-includes: * Scripts/fix-blink-patch: * Scripts/generate-coverage-data: * Scripts/git-add-reviewer: * Scripts/jsc-stress-test-helpers/js-exception-fuzz: * Scripts/jsc-stress-test-helpers/js-executable-allocation-fuzz: * Scripts/jsc-stress-test-helpers/js-osr-exit-fuzz: * Scripts/make-new-script-test: * Scripts/make-script-test-wrappers: * Scripts/package-root: * Scripts/parse-malloc-history: * Scripts/report-include-statistics: * Scripts/resolve-ChangeLogs: * Scripts/run-api-tests: * Scripts/run-bindings-tests: * Scripts/run-content-extension-tester: * Scripts/run-iexploder-tests: * Scripts/run-javascriptcore-tests: * Scripts/run-jsc: * Scripts/run-leaks: * Scripts/run-mangleme-tests: * Scripts/run-minibrowser: * Scripts/run-pageloadtest: * Scripts/run-regexp-tests: * Scripts/run-safari: * Scripts/run-sunspider: * Scripts/run-test-runner: * Scripts/run-webkit-app: * Scripts/run-webkit-httpd: * Scripts/run-webkit-websocketserver: * Scripts/set-webkit-configuration: * Scripts/show-pretty-diff: * Scripts/sort-Xcode-project-file: * Scripts/split-file-by-class: * Scripts/sunspider-compare-results: * Scripts/svn-apply: * Scripts/svn-unapply: * Scripts/test-webkit-scripts: * Scripts/test-webkitperl: * Scripts/update-iexploder-cssproperties: * Scripts/update-javascriptcore-test-results: * Scripts/update-webkit: * Scripts/update-webkit-auxiliary-libs: * Scripts/update-webkit-dependency: * Scripts/update-webkit-libs-jhbuild: * Scripts/update-webkit-localizable-strings: * Scripts/update-webkit-support-libs: * Scripts/update-webkitgtk-libs: * Scripts/update-webkitwpe-libs: * Scripts/webkit-build-directory: * Scripts/webkitperl/LoadAsModule.pm: * Scripts/webkitperl/VCSUtils_unittest/decodeGitBinaryPatch.pl: * Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatch.pl: * Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatchThenSetChangeLogDateAndReviewer.pl: * Scripts/webkitperl/VCSUtils_unittest/fixSVNPatchForAdditionWithHistory.pl: * Scripts/webkitperl/VCSUtils_unittest/generatePatchCommand.pl: * Scripts/webkitperl/VCSUtils_unittest/mergeChangeLogs.pl: * Scripts/webkitperl/VCSUtils_unittest/parseChunkRange.pl: * Scripts/webkitperl/VCSUtils_unittest/parseDiff.pl: * Scripts/webkitperl/VCSUtils_unittest/parseDiffHeader.pl: * Scripts/webkitperl/VCSUtils_unittest/parseDiffWithMockFiles.pl: * Scripts/webkitperl/VCSUtils_unittest/parseFirstEOL.pl: * Scripts/webkitperl/VCSUtils_unittest/parseGitDiffHeader.pl: * Scripts/webkitperl/VCSUtils_unittest/parsePatch.pl: * Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl: * Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffHeader.pl: * Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl: * Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl: * Scripts/webkitperl/VCSUtils_unittest/parseUnifiedDiffHeader.pl: * Scripts/webkitperl/VCSUtils_unittest/prepareParsedPatch.pl: * Scripts/webkitperl/VCSUtils_unittest/removeEOL.pl: * Scripts/webkitperl/VCSUtils_unittest/runCommand.pl: * Scripts/webkitperl/VCSUtils_unittest/runPatchCommand.pl: * Scripts/webkitperl/VCSUtils_unittest/setChangeLogDateAndReviewer.pl: * Scripts/webkitperl/auto-version_unittest/autoVersionTests.pl: * Scripts/webkitperl/auto-version_unittest/versionStampTests.pl: * Scripts/webkitperl/filter-build-webkit_unittest/shouldIgnoreLine_unittests.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/extractLineRangeBeforeAndAfterChange.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/fetchRadarURLFromBugXMLData.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/generateFunctionLists.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/parser_unittests.pl: * Scripts/webkitperl/prepare-ChangeLog_unittest/resources/perl_unittests.pl: * Scripts/webkitperl/run-leaks_unittest/run-leaks-report-v1.0.pl: * Scripts/webkitperl/run-leaks_unittest/run-leaks-report-v2.0-new.pl: * Scripts/webkitperl/run-leaks_unittest/run-leaks-report-v2.0-old.pl: * Scripts/webkitperl/webkitdirs_unittest/appendToEnvironmentVariableList.pl: * Scripts/webkitperl/webkitdirs_unittest/checkForArgumentAndRemoveFromArrayRef.pl: * Scripts/webkitperl/webkitdirs_unittest/checkForArgumentAndRemoveFromArrayRefGettingValue.pl: * Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl: * Scripts/webkitperl/webkitdirs_unittest/prependToEnvironmentVariableList.pl: * Scripts/webkitpy/layout_tests/servers/run_webkit_httpd.py: * ccache/ccache-clang: * ccache/ccache-clang++: * ccache/ccache-wrapper: * gtk/install-dependencies: * iExploder/iexploder-1.3.2/htdocs/iexploder.cgi: * iExploder/iexploder-1.3.2/htdocs/webserver.rb: * iExploder/iexploder-1.3.2/tools/lasthit.rb: * iExploder/iexploder-1.3.2/tools/osx_last_crash.rb: * iExploder/iexploder-1.3.2/tools/showtest.rb: * iExploder/iexploder-1.7.2/src/browser_harness.rb: * iExploder/iexploder-1.7.2/src/iexploder.cgi: * iExploder/iexploder-1.7.2/src/webserver.rb: * iExploder/iexploder-1.7.2/tools/lasthit.rb: * iExploder/iexploder-1.7.2/tools/osx_last_crash.rb: * wpe/install-dependencies: Canonical link: https://commits.webkit.org/197118@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226395 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-01-04 07:18:18 +00:00
use warnings;
use FindBin;
use Getopt::Long;
use lib $FindBin::Bin;
use webkitdirs;
use VCSUtils;
sub checkPythonVersion()
{
# Will exit 0 if Python is 2.7, non-zero otherwise.
`python -c "import sys;sys.exit(sys.version_info[:2] != (2,7))"`;
return exitStatus($?) == 0;
}
sub main()
{
my $checkOnly = 0;
my $showHelp = 0;
my $getOptionsResult = GetOptions(
'check-only!' => \$checkOnly,
'help|h' => \$showHelp,
);
if (!$getOptionsResult || $showHelp) {
print STDERR <<HELP;
Usage: $0 [options]
--check-only Check python version only.
-h|--help Show this help message.
HELP
return 1;
}
# Congrats, your Python is fine.
return 0 if checkPythonVersion();
return 1 if $checkOnly;
print "Your Python version is insufficient to run WebKit's Python code. Please update.\n";
print "See http://trac.webkit.org/wiki/PythonGuidelines for more info.\n";
return 1;
}
exit(main());