lilac2.api
— The lilac.py
API
- 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.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_requests(response, session=None, *, encoding=None)[source]
response
: requestsResponse
object, 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.
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.s: requests.Session
A shared requests.Session object to send out HTTP requests.