-
Notifications
You must be signed in to change notification settings - Fork 46
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
.egg directories not considered in get_pkg_included_file #97
Comments
Changing the function as follows fixes the issue (no time to create a pull request, sorry). def get_pkg_included_file(pkg, file_names):
"""
Attempt to find the package's included file on disk and return the
tuple (included_file_path, included_file_contents).
"""
included_file = LICENSE_UNKNOWN
included_text = LICENSE_UNKNOWN
pkg_dirname = "{}-{}.dist-info".format(
pkg.project_name.replace("-", "_"), pkg.version)
patterns = []
[patterns.extend(sorted(glob.glob(os.path.join(pkg.location,
pkg_dirname,
f))))
for f in file_names]
[patterns.extend(sorted(glob.glob(os.path.join(pkg.location,
'EGG-INFO',
f))))
for f in file_names]
for test_file in patterns:
if os.path.exists(test_file):
included_file = test_file
with open(test_file, encoding='utf-8',
errors='backslashreplace') as included_file_handle:
included_text = included_file_handle.read()
break
return (included_file, included_text) |
@philipaxer Thanks for the report. This issue will be resolved in the next patch version release. |
The egg package is legacy and I haven't used it much. Looking at the specs, it looks like there are two types.
@philipaxer Please provide the full path of the egg package you want to explore for the license file. Of course, you don't need any private information that you don't want printed on your machine. |
This is interesting, i recreated the venv and installed the packages. Now numpy shows as a dist-info package. By going through my native site-packages, i can pick some examples, I am giving you the PATH which contains the LICENSE* (see note below) and Interestingly, I cannot find any py3.9.egg-info directory which has LICENSE. The directory contains the following files:
Perhaps only option 1. from your list has the LICENSE as an explicit file. |
OK, thanks for your information. |
@philipaxer Hi, I tried to respond to the issues you reported. I don't have the egg package installed in my environment, and it is a release candidate version. Can you please report back if this version works well in your environment? # Install the release candidate in your environment
$ pip install 'pip-licenses==3.3.2rc1' If it doesn't work well, please create a pull request in the following branch. You are always welcome to do so. |
Thought I would add some background information. By default no version of As for the |
Hi All,
I noticed that some license files are not correctly identified. This seems to happen because only
.dist-info
directories are considered and.egg
are not tried.This specifically assumes data will reside in .dist-info which is not always true.
In my .venv i have
numpy-1.20.1-py3.9-win-amd64.egg
which is not detected and skipped. Similarly othersregards
Philip
The text was updated successfully, but these errors were encountered: