-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for skipping license paths #851
Conversation
Add support for a new config file with glob like handling of paths as some projects contain license files that are not the license of the project. scan_for_licenses now looks at the configuration and does glob like matching for all the potential license files it tries to add. This change caused a few structural adjustments to the code and a slight style change for importing just the toplevel util submodule that are superficial. Signed-off-by: William Douglas <william.douglas@intel.com>
file_path = 'a/ab' | ||
self.assertFalse(util.globlike_match(file_path, match_name)) | ||
|
||
match_name = ['a', 'b*'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oopsie, will fix.
@@ -274,3 +274,31 @@ def open_auto(*args, **kwargs): | |||
assert 'encoding' not in kwargs | |||
assert 'errors' not in kwargs | |||
return open(*args, encoding="utf-8", errors="surrogateescape", **kwargs) | |||
|
|||
|
|||
def globlike_match(filename, match_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming you didn't edit this aside from moving it to util?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, same function though the signature had to change since it isn't a class method (though it wasn't using any of the object's fields).
license_skips | ||
Each line in the file should be a full path, that path is prefixed into a | ||
tempfile directory + the package tarfile prefix. Requires using '*' to be | ||
effective (e.g. /tmp/*/pkgname-*/path/to/license). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we hide some of this prefix? Especially if it's going to be boilerplate /tmp/*/
... we should just prepend it when skip_license
calls globlike_match
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh that is nicer, thanks.
Add support for a new config file with glob like handling of paths as some projects contain license files that are not the license of the project.
scan_for_licenses now looks at the configuration and does glob like matching for all the potential license files it tries to add.
This change caused a few structural adjustments to the code and a slight style change for importing just the toplevel util submodule that are superficial.