Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
n-dusan committed Oct 30, 2023
1 parent 58a103c commit 183e44a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion upgrade/scripts/upgrade_python_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,22 @@ def get_constraints_file_path(package_name, site_packages_dir=None):

# get oll path with pathlib
oll_path = Path(oll.__file__).parent
print(oll_path)
# get constraints.txt file path from oll_path
constraints_file_path = oll_path / "constraints.txt"
print(constraints_file_path)
if constraints_file_path.exists():
return str(constraints_file_path)
raise ImportError
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])
)

print(site_packages_dir)
package_name = package_name.replace("-", "_")
constraints_file_path = site_packages_dir / package_name / "constraints.txt"
if os.path.exists(constraints_file_path):
Expand Down Expand Up @@ -211,7 +215,9 @@ def install_wheel(
str(parse_wheel_filename(wheel_name)[1]) for wheel_name in wheel_names
]
wheel_mapping = {k: v for (k, v) in zip(parsed_wheel_versions, wheel_paths)}
print(wheel_mapping)
versions = filter_versions(SpecifierSet(version_cmd), parsed_wheel_versions)
print(f"filtered versions: {versions}")
wheel = wheel_mapping.get(versions[-1])
except IndexError:
print(f"Wheel {package_name} not found")
Expand Down Expand Up @@ -247,7 +253,9 @@ def install_wheel(
resp += pip("check")
except:
# try to install with constraints
print("before constraints")
constraints_file_path = get_constraints_file_path(package_name)
print("after constraints")
try:
resp += install_with_constraints(
to_install,
Expand All @@ -257,6 +265,7 @@ def install_wheel(
wheels_path,
*args,
)
print("after constraints 2")
except:
if slack_webhook_url is not None:
try:
Expand Down

0 comments on commit 183e44a

Please sign in to comment.