Skip to content

Commit

Permalink
Remove checks for git and local path from pipfile
Browse files Browse the repository at this point in the history
Signed-off-by: Shreekara <[email protected]>
  • Loading branch information
shreekarSS committed Sep 14, 2022
1 parent b7178d2 commit 15d0a69
Showing 1 changed file with 1 addition and 58 deletions.
59 changes: 1 addition & 58 deletions kebechet/managers/update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def _get_dependency_version(dependency: str, is_dev: bool) -> str:
return ""
elif version is None and package_info.get("path"):
_LOGGER.debug("Skipping... package installation references a local path.")

return ""
if not version:
raise InternalError(
f"Failed to retrieve version information for dependency {dependency}, (dev: {is_dev})"
Expand Down Expand Up @@ -235,62 +235,6 @@ def _get_direct_dependencies_requirements(req_dev: bool) -> set:

return direct_dependencies

def _get_all_packages_versions(self) -> dict:
"""Parse Pipfile.lock file and retrieve all packages in the corresponding locked versions."""
try:
with open("Pipfile.lock") as pipfile_lock:
pipfile_lock_content = json.load(pipfile_lock)
except Exception as exc:
# TODO: open a PR to fix this
raise DependencyManagementError(
f"Failed to load Pipfile.lock file: {str(exc)}"
) from exc

result = {}

for package_name, package_info in pipfile_lock_content["default"].items():
if "git" in package_info:
self._create_unsupported_package_issue(package_name, "git")
raise DependencyManagementError(
"Failed to find version in package that uses git source."
)
elif "path" in package_info:
self._create_unsupported_package_issue(package_name, "local")
raise DependencyManagementError(
"Failed to find version in package that uses local source."
)
result[package_name.lower()] = {
"dev": False,
"version": package_info["version"][len("==") :],
}

for package_name, package_info in pipfile_lock_content["develop"].items():
if "git" in package_info:
self._create_unsupported_package_issue(package_name, "git")
raise DependencyManagementError(
"Failed to find version in package that uses git source."
)
elif "path" in package_info:
self._create_unsupported_package_issue(package_name, "local")
raise DependencyManagementError(
"Failed to find version for package that uses local installation."
)
result[package_name.lower()] = {
"dev": False,
"version": package_info["version"][len("==") :],
}
# Close git as a source issues.

issue = self.get_issue_by_title(
_ISSUE_UNSUPPORTED_PACKAGE.format(env_name=self.runtime_environment)
)
if issue:
issue.comment(
f"Issue closed as no packages use git as a source anymore. Related SHA - {self.sha}"
)
issue.close()
return result

def _create_unsupported_package_issue(self, package_name, pkg_location):
"""Create an issue as Kebechet doesn't support packages with git as source."""
_LOGGER.info("Key Error encountered, due package source being git.")
Expand Down Expand Up @@ -726,7 +670,6 @@ def _do_update(
)

if pipenv_used:
old_environment = self._get_all_packages_versions()
old_direct_dependencies_version = self._get_direct_dependencies_version(
strict=False
)
Expand Down

0 comments on commit 15d0a69

Please sign in to comment.