lilac2.api — The lilac.py API

exception lilac2.api.AurDownloadError(pkgname: str)[source]
lilac2.api.add_arch(extra: Iterable[str]) None

Add more values into the arch shell array in the PKGBUILD file

lilac2.api.add_checkdepends(extra: Iterable[str]) None

Add more values into the checkdepends shell array in the PKGBUILD file

lilac2.api.add_conflicts(extra: Iterable[str]) None

Add more values into the conflicts shell array in the PKGBUILD file

lilac2.api.add_depends(extra: Iterable[str]) None

Add more values into the depends shell array in the PKGBUILD file

lilac2.api.add_groups(extra: Iterable[str]) None

Add more values into the groups shell array in the PKGBUILD file

lilac2.api.add_into_array(which: str, extra: Iterable[str]) None[source]

Add more values into the which shell array in the PKGBUILD file

lilac2.api.add_makedepends(extra: Iterable[str]) None

Add more values into the makedepends shell array in the PKGBUILD file

lilac2.api.add_provides(extra: Iterable[str]) None

Add more values into the provides shell array in the PKGBUILD file

lilac2.api.add_replaces(extra: Iterable[str]) None

Add more values into the replaces shell array in the PKGBUILD file

lilac2.api.at_dir(d: PathLike) Generator[None, None, None][source]
lilac2.api.aur_post_build() None[source]
lilac2.api.aur_pre_build(name: str | None = None, *, do_vcs_update: bool | None = None, maintainers: str | Container[str] = ()) None[source]
lilac2.api.check_library_provides() None[source]
lilac2.api.clean_directory() List[str][source]

clean all PKGBUILD and related files

lilac2.api.download_official_pkgbuild(name: str) list[str][source]
lilac2.api.edit_file(filename: str) Iterator[str][source]

Edit the file in a loop, e.g.:

for line in edit_file('PKGBUILD'):
  if line.startswith('_name='):
    line = '_name=newname'
  print(line)
lilac2.api.gen_pkgbuild(pypi_name: str, pkgname: str | None = None, depends: List[str] | None = None, python2: bool = False, arch: Iterable[str] | None = None, makedepends: List[str] | None = None, optdepends: List[str] | None = None, depends_setuptools: bool = False, check: str | None = None, provides: Iterable[str] | None = None, conflicts: Iterable[str] | None = None, license: str | None = None, license_file: str | None = None, prepare: str | None = None, pep517: bool = False) Tuple[str, str][source]
lilac2.api.get_pkgver_and_pkgrel() Tuple[str | None, int | str | None][source]
lilac2.api.get_srcinfo() bytes[source]
lilac2.api.git_add_files(files: str | List[str], *, force: bool = False) None[source]
lilac2.api.git_commit(*, check_status: bool = True) None[source]
lilac2.api.git_pkgbuild_commit() None[source]
lilac2.api.git_pull() bool[source]
lilac2.api.git_push() None[source]
lilac2.api.git_rm_files(files: List[str]) None[source]
lilac2.api.mediawiki_post_build() None[source]
lilac2.api.mediawiki_pre_build(name: str, mwver: str, desc: str, license: str) None[source]
lilac2.api.obtain_array(name: str) List[str] | None[source]

Obtain an array variable from PKGBUILD.

Works by calling bash to source PKGBUILD, writing the array to a temporary file, and reading from the file.

lilac2.api.obtain_depends() List[str] | None[source]
lilac2.api.obtain_makedepends() List[str] | None[source]
lilac2.api.obtain_optdepends(parse_dict: bool = True) Dict[str, str] | List[str] | None[source]
lilac2.api.parse_document_from_requests(response, session=None, *, encoding=None)[source]

response: requests Response object, or URL encoding: override detected encoding

lilac2.api.pypi_post_build() None[source]
lilac2.api.pypi_pre_build(depends: List[str] | None = None, python2: bool = False, pypi_name: str | None = None, arch: Iterable[str] | None = None, makedepends: List[str] | None = None, depends_setuptools: bool = True, provides: Iterable[str] | None = None, conflicts: Iterable[str] | None = None, prepare: str | None = None, check: str | None = None, optdepends: List[str] | None = None, license: str | None = None, license_file: str | None = None, pep517: bool = False) None[source]
lilac2.api.run_cmd(cmd: Sequence[str | Path], **kwargs) str[source]
lilac2.api.run_protected(cmd: Sequence[str | Path], **kwargs) str[source]

run a command that sources PKGBUILD and thus is protected by bwrap

lilac2.api.single_main(build_prefix: str = 'makepkg') None[source]
class lilac2.api.suppress(*exceptions)[source]

Context manager to suppress specified exceptions

After the exception is suppressed, execution proceeds with the next statement following the with statement.

with suppress(FileNotFoundError):

os.remove(somefile)

# Execution still resumes here if the file was already removed

lilac2.api.update_aur_repo() None[source]

update the package on AUR if suitable.

lilac must have the permission to do so, i.e. added as a co-maintainer.

For VCS packages, if only the version changes, the package on AUR won’t be updated.

lilac2.api.update_pkgrel(rel: int | str | None = None) None[source]
lilac2.api.update_pkgver_and_pkgrel(newver: str, *, updpkgsums: bool = True) None[source]
lilac2.api.vcs_update() None[source]

update VCS sources

lilac2.api.s: requests.Session

A shared requests.Session object to send out HTTP requests.