Skip to content

Commit

Permalink
Add config to require licences for pip_library and python_wheel (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatskaari committed Jun 19, 2024
1 parent d9b3875 commit 61524bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .plzconfig
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ Optional = true
Inherit = true
Help = The tool used to resolve wheels with using the pypi API.

[PluginConfig "require_licences"]
DefaultValue = false
Type = bool
Inherit = true
Help = If set, the licences field on pip_library and python_wheel will be mandatory


[PluginConfig "feature_flags"]
DefaultValue = ""
Repeatable = true
Expand Down
7 changes: 6 additions & 1 deletion build_defs/python.build_defs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,12 @@ def _add_licences(name, output):
add_licence(name, line.split(' :: ')[-1])
found = True
if not found:
log.warning('No licence found for %s, should add licences = [...] to the rule', name.lstrip('_').split('#')[0])
name = name.lstrip('_').split('#')[0]
msg = f'No licence found for {name}, should add licences = [...] to the rule'
if CONFIG.PYTHON.REQUIRE_LICENCES:
fail(msg)
else:
log.warning(msg)


# `pdb` and `debugpy` are the current debuggers supported by the PEX tool.
Expand Down

0 comments on commit 61524bf

Please sign in to comment.