Skip to content

Commit

Permalink
fix(test): get sitepackages if only one sitepackage
Browse files Browse the repository at this point in the history
This fix is a result for failing linux CI builds, where getsitepackages returned a list with only 1 element, thus raising list index out of range for index [1].
  • Loading branch information
n-dusan committed Oct 30, 2023
1 parent 183e44a commit 78d166b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions upgrade/scripts/upgrade_python_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ def get_constraints_file_path(package_name, site_packages_dir=None):
except (TypeError, ImportError, AttributeError):
print("constraints error")
print(site.getsitepackages())
site_packages_dir = (
Path(site_packages_dir)
if site_packages_dir
else Path(site.getsitepackages()[1])
)
if site_packages_dir:
site_packages_dir = Path(site_packages_dir)
else:
try:
site_packages_dir = Path(site.getsitepackages()[1])
except IndexError:
site_packages_dir = Path(site.getsitepackages()[0])

print(site_packages_dir)
package_name = package_name.replace("-", "_")
constraints_file_path = site_packages_dir / package_name / "constraints.txt"
Expand Down

0 comments on commit 78d166b

Please sign in to comment.