Skip to content

Commit

Permalink
Enforce license info in src/brave (fixes brave/brave-browser#9408)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarier committed Apr 23, 2020
1 parent 601365b commit c376082
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 12 additions & 2 deletions patches/tools-licenses.py.patch
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
diff --git a/tools/licenses.py b/tools/licenses.py
index 6405b31497a425c68b0486a2653071f23e515671..e957c14c924a7a405bf9e20f3c8e2ffc56ea1306 100755
index 6405b31497a425c68b0486a2653071f23e515671..2468e4120f05fd6d65c197281fe16c9269edb9d5 100755
--- a/tools/licenses.py
+++ b/tools/licenses.py
@@ -35,6 +35,7 @@ else:
_REPOSITORY_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
sys.path.insert(0, os.path.join(_REPOSITORY_ROOT, 'build/android/gyp'))
from util import build_utils
+from brave_license_helper import AddBraveCredits, BRAVE_THIRD_PARTY_DIRS
+from brave_license_helper import AddBraveCredits, BRAVE_THIRD_PARTY_DIRS, CheckBraveMissingLicense


# Paths from the root of the tree to directories to skip.
Expand All @@ -28,3 +28,13 @@ index 6405b31497a425c68b0486a2653071f23e515671..e957c14c924a7a405bf9e20f3c8e2ffc
# Add all subdirectories that are not marked for skipping.
for dir in dirs:
dirpath = os.path.join(path, dir)
@@ -663,7 +666,8 @@ def GenerateCredits(
for path in third_party_dirs:
try:
metadata = ParseDir(path, _REPOSITORY_ROOT)
- except LicenseError:
+ except LicenseError as e:
+ CheckBraveMissingLicense(path, e)
# TODO(phajdan.jr): Convert to fatal error (http://crbug.com/39240).
continue
if metadata['License File'] == NOT_SHIPPED:
5 changes: 5 additions & 0 deletions script/brave_license_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,8 @@ def AddBraveCredits(prune_paths, special_cases, prune_dirs, additional_paths):
additional_paths = tuple(additional_list)

return (prune_dirs, additional_paths)


def CheckBraveMissingLicense(path, error):
if path.startswith('brave/'):
raise error

0 comments on commit c376082

Please sign in to comment.