Skip to content

Commit

Permalink
fix(install_cli: edit_pkgbuild_during_the_build): handle case when in…
Browse files Browse the repository at this point in the history
…stall_info object isn't created yet - 2
  • Loading branch information
actionless committed Dec 29, 2024
1 parent 95b9ce0 commit 3c24237
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions pikaur/install_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from typing import TYPE_CHECKING

from .args import parse_args, reconstruct_args
from .aur import find_aur_packages
from .build import PackageBuild, PkgbuildChanged, clone_aur_repos
from .config import (
DECORATION,
Expand Down Expand Up @@ -316,17 +317,19 @@ def _get_pkgbuild_for_name_or_provided(self, pkg_name: str) -> PackageBuild:
)

def edit_pkgbuild_during_the_build(self, pkg_name: str) -> None:
if getattr(self, "install_info", None):
updated_pkgbuilds = self._clone_aur_repos([
install_info
for install_info in (
self.install_info._all_aur_updates_raw # pylint: disable=protected-access # noqa: SLF001,E501,RUF100
)
if install_info.name == pkg_name
])
if not updated_pkgbuilds:
return
self.package_builds_by_name.update(updated_pkgbuilds)
install_infos = [
install_info
for install_info in (
self.install_info._all_aur_updates_raw # pylint: disable=protected-access # noqa: SLF001,E501,RUF100
)
if install_info.name == pkg_name
] if getattr(self, "install_info", None) else [
AURInstallInfo(package=find_aur_packages([pkg_name])[0][0]),
]
updated_pkgbuilds = self._clone_aur_repos(install_infos)
if not updated_pkgbuilds:
return
self.package_builds_by_name.update(updated_pkgbuilds)
pkg_build = self._get_pkgbuild_for_name_or_provided(pkg_name)
if not edit_file(
pkg_build.pkgbuild_path,
Expand Down

0 comments on commit 3c24237

Please sign in to comment.