lilac2.api — The lilac.py API
- class lilac2.api.Union
Represent a union type
E.g. for int | str
- lilac2.api.add_arch(extra: Iterable[str]) None
Add more values into the
archshell array in the PKGBUILD file
- lilac2.api.add_checkdepends(extra: Iterable[str]) None
Add more values into the
checkdependsshell array in the PKGBUILD file
- lilac2.api.add_conflicts(extra: Iterable[str]) None
Add more values into the
conflictsshell array in the PKGBUILD file
- lilac2.api.add_depends(extra: Iterable[str]) None
Add more values into the
dependsshell array in the PKGBUILD file
- lilac2.api.add_groups(extra: Iterable[str]) None
Add more values into the
groupsshell array in the PKGBUILD file
- lilac2.api.add_into_array(which: str, extra: Iterable[str]) None[source]
Add more values into the
whichshell array in the PKGBUILD file
- lilac2.api.add_makedepends(extra: Iterable[str]) None
Add more values into the
makedependsshell array in the PKGBUILD file
- lilac2.api.add_provides(extra: Iterable[str]) None
Add more values into the
providesshell array in the PKGBUILD file
- lilac2.api.add_replaces(extra: Iterable[str]) None
Add more values into the
replacesshell array in the PKGBUILD file
- lilac2.api.aur_pre_build(name: str | None = None, *, do_vcs_update: bool | None = None, maintainers: str | Container[str] = ()) None[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.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.parse_document_from_httpx(response, session=None, *, encoding=None)[source]
response: httpx or requestsResponseobject, or URLencoding: override detected encoding
- 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_protected(cmd: Sequence[str | Path], **kwargs) str[source]
run a command that sources PKGBUILD and thus is protected by bwrap
- 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.
lilacmust 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.s: httpx.Client
A shared httpx.Client object to send out HTTP requests.