Skip to content

Commit

Permalink
replaced deprecated pkg_resources with importlib
Browse files Browse the repository at this point in the history
  • Loading branch information
lucarebuffi committed Jan 20, 2025
1 parent 67ea078 commit 9633a52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions oasys/application/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,10 @@ def set_packages(self, installable):
# 17 Jan 2025: replaced pkg_resources with importlib (for now the third party version)
# because of deprecation
#dists = {dist.project_name: dist for dist in installed}
try: dists = {dist.name: dist for dist in installed}
except: dists = {dist.project_name: dist for dist in installed}
dists = {}
for dist in installed:
try: dists[dist.project_name] = dist
except: dists[dist.name] = dist
packages = {pkg.name: pkg for pkg in packages}

# For every pypi available distribution not listed by
Expand Down Expand Up @@ -934,8 +936,11 @@ def installable_items(pypipackages, installed=[]):
"""
# 17 Jan 2025: replaced pkg_resources with importlib (for now the third party version)
# because of deprecation
#dists = {dist.project_name: dist for dist in installed}
dists = {dist.name: dist for dist in installed}
# dists = {dist.project_name: dist for dist in installed}
dists = {}
for dist in installed:
try: dists[dist.project_name] = dist
except: dists[dist.name] = dist
packages = {pkg.name: pkg for pkg in pypipackages}

# For every pypi available distribution not listed by
Expand Down
6 changes: 4 additions & 2 deletions oasys/application/internal_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,10 @@ def set_packages(self, installable):
# 17 Jan 2025: replaced pkg_resources with importlib (for now the third party version)
# because of deprecation
#dists = {dist.project_name: dist for dist in installed}
try: dists = {dist.name: dist for dist in installed}
except: dists = {dist.project_name: dist for dist in installed}
dists = {}
for dist in installed:
try: dists[dist.project_name] = dist
except: dists[dist.name] = dist
packages = {pkg.name: pkg for pkg in packages}

# For every pypi available distribution not listed by
Expand Down

0 comments on commit 9633a52

Please sign in to comment.