• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/pw_presubmit/py/pw_presubmit/build.py b/pw_presubmit/py/pw_presubmit/build.py
2index 4a370e33..224ad9c6 100644
3--- a/pw_presubmit/py/pw_presubmit/build.py
4+++ b/pw_presubmit/py/pw_presubmit/build.py
5@@ -20,7 +20,6 @@ from pathlib import Path
6 import re
7 from typing import Container, Dict, Iterable, List, Mapping, Set, Tuple
8
9-from pw_package import package_manager
10 from pw_presubmit import call, log_run, plural, PresubmitFailure, tools
11
12 _LOG = logging.getLogger(__name__)
13diff --git a/pw_presubmit/py/pw_presubmit/format_code.py b/pw_presubmit/py/pw_presubmit/format_code.py
14index 19d09546..dae2e813 100755
15--- a/pw_presubmit/py/pw_presubmit/format_code.py
16+++ b/pw_presubmit/py/pw_presubmit/format_code.py
17@@ -229,8 +229,7 @@ def print_format_check(errors: Dict[Path, str],
18             except ValueError:
19                 return Path(path).resolve()
20
21-        message = (f'  pw format --fix {path_relative_to_cwd(path)}'
22-                   for path in errors)
23+        message = (f' tensorflow/lite/{__file__} --fix {path}' for path in errors)
24         _LOG.warning('To fix formatting, run:\n\n%s\n', '\n'.join(message))
25
26
27diff --git a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
28index 794967db..061db7ea 100755
29--- a/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
30+++ b/pw_presubmit/py/pw_presubmit/pigweed_presubmit.py
31@@ -220,8 +220,8 @@ def clang_tidy(ctx: PresubmitContext):
32
33
34 # The first line must be regex because of the '20\d\d' date
35-COPYRIGHT_FIRST_LINE = r'Copyright 20\d\d The Pigweed Authors'
36-COPYRIGHT_COMMENTS = r'(#|//| \*|REM|::)'
37+COPYRIGHT_FIRST_LINE = r'Copyright 20\d\d The TensorFlow Authors. All Rights Reserved.'
38+COPYRIGHT_COMMENTS = r'(#|//|\*|REM|::|/\*)'
39 COPYRIGHT_BLOCK_COMMENTS = (
40     # HTML comments
41     (r'<!--', r'-->'), )
42@@ -232,21 +232,23 @@ COPYRIGHT_FIRST_LINE_EXCEPTIONS = (
43     '@echo off',
44     '# -*-',
45     ':',
46+    '# Lint as',
47+    '# coding=utf-8'
48 )
49
50 COPYRIGHT_LINES = tuple("""\
51
52-Licensed under the Apache License, Version 2.0 (the "License"); you may not
53-use this file except in compliance with the License. You may obtain a copy of
54-the License at
55+Licensed under the Apache License, Version 2.0 (the "License");
56+you may not use this file except in compliance with the License.
57+You may obtain a copy of the License at
58
59-    https://www.apache.org/licenses/LICENSE-2.0
60+    http://www.apache.org/licenses/LICENSE-2.0
61
62 Unless required by applicable law or agreed to in writing, software
63-distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
64-WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
65-License for the specific language governing permissions and limitations under
66-the License.
67+distributed under the License is distributed on an "AS IS" BASIS,
68+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
69+See the License for the specific language governing permissions and
70+limitations under the License.
71 """.splitlines())
72
73 _EXCLUDE_FROM_COPYRIGHT_NOTICE: Sequence[str] = (
74@@ -344,6 +346,11 @@ def copyright_notice(ctx: PresubmitContext):
75                 errors.append(path)
76                 continue
77
78+            # Special handling for TFLM style of copyright+license in the cc
79+            # files.
80+            if comment == '/*':
81+              comment = ''
82+
83             if end_block_comment:
84                 expected_lines = COPYRIGHT_LINES + (end_block_comment, )
85             else:
86@@ -354,6 +361,10 @@ def copyright_notice(ctx: PresubmitContext):
87                     expected_line = expected + '\n'
88                 elif comment:
89                     expected_line = (comment + ' ' + expected).rstrip() + '\n'
90+                else:
91+                    # Special handling for TFLM style of copyright+license in
92+                    # the cc files.
93+                    expected_line = (expected).rstrip() + '\n'
94
95                 if expected_line != actual:
96                     _LOG.warning('  bad line: %r', actual)
97@@ -475,6 +486,10 @@ BROKEN = (
98     gn_nanopb_build,
99 )
100
101+COPYRIGHT_NOTICE = (
102+    copyright_notice,
103+)
104+
105 QUICK = (
106     commit_message_format,
107     init_cipd,
108@@ -509,7 +524,8 @@ FULL = (
109     build_env_setup,
110 )
111
112-PROGRAMS = Programs(broken=BROKEN, quick=QUICK, full=FULL)
113+PROGRAMS = Programs(broken=BROKEN, quick=QUICK, full=FULL,
114+                    copyright_notice=COPYRIGHT_NOTICE)
115
116
117 def parse_args() -> argparse.Namespace:
118