aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTony Aiuto <aiuto@google.com>2022-01-20 00:36:43 -0500
committerTony Aiuto <aiuto@google.com>2022-01-20 00:42:11 -0500
commit664bde143eb36901ccef33183399147199676c8b (patch)
tree0534a4cde088b54c9e4cf168fa754abe4b22acab /tools
parenta40563d6ea1ea5d6745762bc04eb3f07d14e3fb2 (diff)
downloadbazelbuild-rules_license-664bde143eb36901ccef33183399147199676c8b.tar.gz
First round of cleanup to start release 1 sprint.
- Add deps.bzl (properly depend on python) - Add license rule for entire package. - Update checker_demo to account for bazel fixes to UTF-8 support - Add some missing copyright notices There is certainly more to do. I am breaking work into either logical or 1 day chunks.
Diffstat (limited to 'tools')
-rw-r--r--tools/BUILD23
-rw-r--r--tools/checker_demo.py7
2 files changed, 23 insertions, 7 deletions
diff --git a/tools/BUILD b/tools/BUILD
index d3a5658..c331d9a 100644
--- a/tools/BUILD
+++ b/tools/BUILD
@@ -1,4 +1,25 @@
-# License declaration and compliance checking rules.
+# Copyright 2022 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# License declaration and compliance checking tools.
+
+load("@rules_license//rules:license.bzl", "license")
+
+package(
+ default_applicable_licenses = [":license"],
+ default_visibility = ["//visibility:public"],
+)
py_binary(
name = "checker_demo",
diff --git a/tools/checker_demo.py b/tools/checker_demo.py
index 0b57cee..32ec5f9 100644
--- a/tools/checker_demo.py
+++ b/tools/checker_demo.py
@@ -28,12 +28,7 @@ _ALWAYS_ALLOWED_CONDITIONS = frozenset(['notice', 'permissive', 'unencumberd'])
def _get_licenses(licenses_info):
with codecs.open(licenses_info, encoding='utf-8') as licenses_file:
- # TODO(aiuto): Bazel is not parsing the BUILD file as utf-8, so it is
- # double encoding characters. We should use the line below, but we have
- # to hack up a double utf-8 decode.
- # return json.loads(licenses_file.read())
- b = bytearray([ord(c) for c in licenses_file.read()])
- return json.loads(b.decode('utf-8'))
+ return json.loads(licenses_file.read())
def _do_report(out, licenses):