Skip to content

Commit

Permalink
replace pkg_resources.working_set with importlib.metadata.distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 committed Jul 19, 2023
1 parent 9cd14d0 commit 8f9b04f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions package/windows/pyinstaller.spec
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import shutil
import subprocess
import sys

import pkg_resources

from PyInstaller.utils.hooks import collect_data_files, collect_submodules

datas = []
Expand Down Expand Up @@ -148,11 +146,11 @@ It includes mainy software packages with different licenses:
- Qt ({PyQt5.QtCore.qVersion()}): GNU Lesser General Public License v3, https://www.qt.io/
""")

for dist in sorted(pkg_resources.working_set, key=lambda d: d.key):
license = importlib.metadata.metadata(dist.key).get('License')
homepage = importlib.metadata.metadata(dist.key).get('Home-page')
for dist in sorted(importlib.metadata.distributions(), key=lambda d: d.name.lower()):
license = dist.metadata.get('License')
homepage = dist.metadata.get('Home-page')
info = ", ".join(info for info in (license, homepage) if info)
f.write(f"- {dist.project_name} ({importlib.metadata.version(dist.key)}): {info}\n")
f.write(f"- {dist.name} ({dist.version}): {info}\n")

create_license_file('LICENSE')

Expand Down

0 comments on commit 8f9b04f

Please sign in to comment.