summaryrefslogtreecommitdiffstats
path: root/third_party/PRESUBMIT.py
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 00:11:23 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-12 00:11:23 +0000
commit99f1a4822a92ca08f782d0b7f806743dea4a7ada (patch)
tree4637af2b4a492aa6964c853bd4e21576eec71c5b /third_party/PRESUBMIT.py
parent600ea40f950f2c2a177428986b9a2d557e7a8c90 (diff)
downloadchromium_src-99f1a4822a92ca08f782d0b7f806743dea4a7ada.zip
chromium_src-99f1a4822a92ca08f782d0b7f806743dea4a7ada.tar.gz
chromium_src-99f1a4822a92ca08f782d0b7f806743dea4a7ada.tar.bz2
Remove DOS line endings from third_party/PRESUBMIT.py
No behavior change. BUG=none TEST=none Review URL: http://codereview.chromium.org/6825059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/PRESUBMIT.py')
-rw-r--r--third_party/PRESUBMIT.py134
1 files changed, 67 insertions, 67 deletions
diff --git a/third_party/PRESUBMIT.py b/third_party/PRESUBMIT.py
index b3b5588..88194cb 100644
--- a/third_party/PRESUBMIT.py
+++ b/third_party/PRESUBMIT.py
@@ -1,67 +1,67 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-def _CheckThirdPartyReadmesUpdated(input_api, output_api):
- """
- Checks to make sure that README.chromium files are properly updated
- when dependancies in third_party are modified.
- """
- readmes = []
- files = []
- errors = []
- for f in input_api.AffectedFiles():
- if f.LocalPath().startswith('third_party' + input_api.os_path.sep):
- files.append(f)
- if f.LocalPath().endswith("README.chromium"):
- readmes.append(f)
- if files and not readmes:
- errors.append(output_api.PresubmitPromptWarning(
- 'When updating or adding third party code the appropriate\n'
- '\'README.chromium\' file should also be updated with the correct\n'
- 'version and package information.', files))
- if not readmes:
- return errors
-
- name_pattern = input_api.re.compile(
- r'^Name: [a-zA-Z0-9_\-\.]+\r?$',
- input_api.re.IGNORECASE | input_api.re.MULTILINE)
- shortname_pattern = input_api.re.compile(
- r'^Short Name: [a-zA-Z0-9_\-\.]+\r?$',
- input_api.re.IGNORECASE | input_api.re.MULTILINE)
- version_pattern = input_api.re.compile(
- r'^Version: [a-zA-Z0-9_\-\.]+\r?$',
- input_api.re.IGNORECASE | input_api.re.MULTILINE)
- release_pattern = input_api.re.compile(
- r'Security Critical: (yes)|(no)\r?$',
- input_api.re.IGNORECASE | input_api.re.MULTILINE)
-
- for f in readmes:
- contents = input_api.ReadFile(f)
- if (not shortname_pattern.search(contents)
- and not name_pattern.search(contents)):
- errors.append(output_api.PresubmitError(
- 'Third party README files should contain either a \'Short Name\' or\n'
- 'a \'Name\' which is the name under which the package is\n'
- 'distributed. Check README.chromium.template for details.',
- [f]))
- if not version_pattern.search(contents):
- errors.append(output_api.PresubmitError(
- 'Third party README files should contain a \'Version\' field.\n'
- 'If the package is not versioned or the version is not known\n'
- 'list the version as \'unknown\'.\n'
- 'Check README.chromium.template for details.',
- [f]))
- if not release_pattern.search(contents):
- errors.append(output_api.PresubmitError(
- 'Third party README files should contain a \'Security Critical\'\n'
- 'field. This field specifies whether the package is built with\n'
- 'Chromium. Check README.chromium.template for details.',
- [f]))
- return errors
-
-
-def CheckChangeOnUpload(input_api, output_api):
- results = []
- results.extend(_CheckThirdPartyReadmesUpdated(input_api, output_api))
- return results
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+def _CheckThirdPartyReadmesUpdated(input_api, output_api):
+ """
+ Checks to make sure that README.chromium files are properly updated
+ when dependancies in third_party are modified.
+ """
+ readmes = []
+ files = []
+ errors = []
+ for f in input_api.AffectedFiles():
+ if f.LocalPath().startswith('third_party' + input_api.os_path.sep):
+ files.append(f)
+ if f.LocalPath().endswith("README.chromium"):
+ readmes.append(f)
+ if files and not readmes:
+ errors.append(output_api.PresubmitPromptWarning(
+ 'When updating or adding third party code the appropriate\n'
+ '\'README.chromium\' file should also be updated with the correct\n'
+ 'version and package information.', files))
+ if not readmes:
+ return errors
+
+ name_pattern = input_api.re.compile(
+ r'^Name: [a-zA-Z0-9_\-\.]+\r?$',
+ input_api.re.IGNORECASE | input_api.re.MULTILINE)
+ shortname_pattern = input_api.re.compile(
+ r'^Short Name: [a-zA-Z0-9_\-\.]+\r?$',
+ input_api.re.IGNORECASE | input_api.re.MULTILINE)
+ version_pattern = input_api.re.compile(
+ r'^Version: [a-zA-Z0-9_\-\.]+\r?$',
+ input_api.re.IGNORECASE | input_api.re.MULTILINE)
+ release_pattern = input_api.re.compile(
+ r'Security Critical: (yes)|(no)\r?$',
+ input_api.re.IGNORECASE | input_api.re.MULTILINE)
+
+ for f in readmes:
+ contents = input_api.ReadFile(f)
+ if (not shortname_pattern.search(contents)
+ and not name_pattern.search(contents)):
+ errors.append(output_api.PresubmitError(
+ 'Third party README files should contain either a \'Short Name\' or\n'
+ 'a \'Name\' which is the name under which the package is\n'
+ 'distributed. Check README.chromium.template for details.',
+ [f]))
+ if not version_pattern.search(contents):
+ errors.append(output_api.PresubmitError(
+ 'Third party README files should contain a \'Version\' field.\n'
+ 'If the package is not versioned or the version is not known\n'
+ 'list the version as \'unknown\'.\n'
+ 'Check README.chromium.template for details.',
+ [f]))
+ if not release_pattern.search(contents):
+ errors.append(output_api.PresubmitError(
+ 'Third party README files should contain a \'Security Critical\'\n'
+ 'field. This field specifies whether the package is built with\n'
+ 'Chromium. Check README.chromium.template for details.',
+ [f]))
+ return errors
+
+
+def CheckChangeOnUpload(input_api, output_api):
+ results = []
+ results.extend(_CheckThirdPartyReadmesUpdated(input_api, output_api))
+ return results