raimon49 / pip-licenses

Dump the license list of packages installed with pip.
MIT License
314 stars 45 forks source link

Order of glob depends on environment #69

Closed adriangonz closed 4 years ago

adriangonz commented 4 years ago

The way that pip-licenses finds license objects in a repo, is by globbing LICENSE*, LICENCE* and COPYING*. However, the output of glob.glob in Python seems to be dependant on the environment.

https://github.com/raimon49/pip-licenses/blob/9c8325920eb3c3e77e0c7e9304c48b7ea9f91c56/piplicenses.py#L131-L151

This becomes an issue in repositories like cryptography, where you have 3 different license files: LICENSE.APACHE, LICENSE.BSD and LICENSE.PSF. Therefore, depending on the environment, pip-licenses will choose one or another.

Suggested solution

One way to fix this would be to sort the output of glob.glob(), so that it's consistent regardless of the environment.

raimon49 commented 4 years ago

@adamchainz Thanks for the report and suggestions.

I will be using the glob.glob() results sorted in the next release to provide consistent output.

raimon49 commented 4 years ago

This issue is addressed in version 2.2.1. https://pypi.org/project/pip-licenses/2.2.1/

If your problem is resolved, please close this issue.

adriangonz commented 4 years ago

@raimon49 thanks for the fix! That was really quick!!

I can confirm that the issue is now resolved in 2.2.1.