Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
cf34b46b
Unverified
Commit
cf34b46b
authored
9 months ago
by
Joost Lekkerkerker
Committed by
GitHub
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix Audit license script comments (#121374)
parent
3c14aa12
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
script/licenses.py
+12
-6
12 additions, 6 deletions
script/licenses.py
with
12 additions
and
6 deletions
script/licenses.py
+
12
−
6
View file @
cf34b46b
...
...
@@ -4,6 +4,7 @@ from __future__ import annotations
from
dataclasses
import
dataclass
import
json
from
pathlib
import
Path
import
sys
from
awesomeversion
import
AwesomeVersion
...
...
@@ -218,7 +219,7 @@ TODO = {
def
main
()
->
int
:
"""
Run the main script.
"""
raw_licenses
=
json
.
load
(
open
(
"
licenses.json
"
))
raw_licenses
=
json
.
load
s
(
Path
(
"
licenses.json
"
)
.
read_text
()
)
package_definitions
=
[
PackageDefinition
.
from_dict
(
data
)
for
data
in
raw_licenses
]
exit_code
=
0
for
package
in
package_definitions
:
...
...
@@ -232,25 +233,29 @@ def main() -> int:
if
previous_unapproved_version
<
package
.
version
:
if
approved
:
print
(
f
"
Approved license detected for
{
package
.
name
}
@
{
package
.
version
}
:
{
package
.
license
}
"
"
Approved license detected for
"
f
"
{
package
.
name
}
@
{
package
.
version
}
:
{
package
.
license
}
"
)
print
(
"
Please remove the package from the TODO list.
"
)
print
(
""
)
else
:
print
(
f
"
We could not detect an OSI-approved license for
{
package
.
name
}
@
{
package
.
version
}
:
{
package
.
license
}
"
"
We could not detect an OSI-approved license for
"
f
"
{
package
.
name
}
@
{
package
.
version
}
:
{
package
.
license
}
"
)
print
(
""
)
exit_code
=
1
elif
not
approved
and
package
.
name
not
in
EXCEPTIONS
:
print
(
f
"
We could not detect an OSI-approved license for
{
package
.
name
}
@
{
package
.
version
}
:
{
package
.
license
}
"
"
We could not detect an OSI-approved license for
"
f
"
{
package
.
name
}
@
{
package
.
version
}
:
{
package
.
license
}
"
)
print
(
""
)
exit_code
=
1
elif
approved
and
package
.
name
in
EXCEPTIONS
:
print
(
f
"
Approved license detected for
{
package
.
name
}
@
{
package
.
version
}
:
{
package
.
license
}
"
"
Approved license detected for
"
f
"
{
package
.
name
}
@
{
package
.
version
}
:
{
package
.
license
}
"
)
print
(
f
"
Please remove the package from the EXCEPTIONS list:
{
package
.
name
}
"
)
print
(
""
)
...
...
@@ -259,7 +264,8 @@ def main() -> int:
for
package
in
[
*
TODO
.
keys
(),
*
EXCEPTIONS
]:
if
package
not
in
current_packages
:
print
(
f
"
Package
{
package
}
is tracked, but not used. Please remove from the licenses.py file.
"
f
"
Package
{
package
}
is tracked, but not used. Please remove from the licenses.py
"
"
file.
"
)
print
(
""
)
exit_code
=
1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment