meta_package_manager.managers.luarocks module¶
- class meta_package_manager.managers.luarocks.LuaRocks[source]¶
Bases:
PackageManagerLuaRocks, the package manager for Lua modules.
A package is a rock, identified by the bare name every listing prints. Its version carries a packaging revision after a dash (
3.1.2-0), kept verbatim because that is the formluarocks installaccepts back.Note
Every read passes
--porcelain, which replaces the default grouped display with one tab-separated record per line.Note
Search is what makes this a class rather than a bundled definition.
luarocks searchprints one row per (rock, version, kind) triple, so a single rock comes back a dozen times over: once per published version, and again for each of therockspecandsrcforms it ships in. mpm keys a package on its id alone, so the rows are reduced here to one entry per rock. The installed and outdated listings get the same treatment, LuaRocks being able to hold several versions of a rock in one tree.Caution
--no-projectis load-bearing. LuaRocks walks up from the working directory looking for a project tree and silently switches to it when one is found, so without the flag the inventory would answer for whichever directory mpm happened to be invoked from instead of for the machine.haxelibforces--globalagainst the same hazard.The flag is a global one, placed before the subcommand, which is why it is declared as
pre_argsrather than repeated per operation. The version probe skipspre_argsentirely and so runs bare.Caution
Reads and writes disagree about scope, and deliberately so.
listreports every configured tree at once, which is the right answer for an inventory of the machine: the system tree and the user’s~/.luarocksboth show up, each row naming the tree holding it.installandremoveact on one tree only, the default one, so removing a rock that lives in the other tree fails withError: Could not find rock 'say' in /opt/homebrew.That asymmetry is left as LuaRocks defines it rather than papered over. Forcing
--localwould make the user tree writable at the cost of the system one, and forcing--globalthe reverse; neither is right for every host, and the failure is loud, immediate and names the tree it searched.Note
No
upgrade --all: LuaRocks has no command updating every installed rock,installbeing what upgrades a named one in place. mpm backfills the bulk case fromoutdatedplus the per-rock upgrade.No
synceither, nothing refreshing the manifest without also downloading, and nocleanup:luarocks purgeempties an entire tree rather than reclaiming anything, which is a mass removal and not a cleanup.Documentation: LuaRocks documentation.
Initialize
cli_errorslist.- homepage_url: str | None = 'https://luarocks.org'¶
Home page of the project, only used in documentation for reference.
- platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='aix', name='IBM AIX'), Platform(id='almalinux', name='AlmaLinux'), Platform(id='alpine', name='Alpine Linux'), Platform(id='altlinux', name='ALT Linux'), Platform(id='amzn', name='Amazon Linux'), Platform(id='android', name='Android'), Platform(id='arch', name='Arch Linux'), Platform(id='buildroot', name='Buildroot'), Platform(id='cachyos', name='CachyOS'), Platform(id='centos', name='CentOS'), Platform(id='chromeos', name='ChromeOS'), Platform(id='clearlinux', name='Clear Linux OS'), Platform(id='cloudlinux', name='CloudLinux OS'), Platform(id='cygwin', name='Cygwin'), Platform(id='debian', name='Debian'), Platform(id='dragonfly_bsd', name='DragonFly BSD'), Platform(id='endeavouros', name='EndeavourOS'), Platform(id='exherbo', name='Exherbo Linux'), Platform(id='fedora', name='Fedora'), Platform(id='freebsd', name='FreeBSD'), Platform(id='generic_linux', name='Generic Linux'), Platform(id='gentoo', name='Gentoo Linux'), Platform(id='guix', name='Guix System'), Platform(id='haiku', name='Haiku'), Platform(id='hurd', name='GNU/Hurd'), Platform(id='ibm_powerkvm', name='IBM PowerKVM'), Platform(id='illumos', name='illumos'), Platform(id='kali', name='Kali Linux'), Platform(id='kvmibm', name='KVM for IBM z Systems'), Platform(id='linuxmint', name='Linux Mint'), Platform(id='macos', name='macOS'), Platform(id='mageia', name='Mageia'), Platform(id='mandriva', name='Mandriva Linux'), Platform(id='manjaro', name='Manjaro Linux'), Platform(id='midnightbsd', name='MidnightBSD'), Platform(id='netbsd', name='NetBSD'), Platform(id='nixos', name='NixOS'), Platform(id='nobara', name='Nobara'), Platform(id='openbsd', name='OpenBSD'), Platform(id='opensuse', name='openSUSE'), Platform(id='openwrt', name='OpenWrt'), Platform(id='oracle', name='Oracle Linux'), Platform(id='os400', name='IBM i'), Platform(id='parallels', name='Parallels'), Platform(id='pidora', name='Pidora'), Platform(id='pikaos', name='PikaOS'), Platform(id='raspbian', name='Raspbian'), Platform(id='rhel', name='RedHat Enterprise Linux'), Platform(id='rocky', name='Rocky Linux'), Platform(id='scientific', name='Scientific Linux'), Platform(id='slackware', name='Slackware'), Platform(id='sles', name='SUSE Linux Enterprise Server'), Platform(id='slitaz', name='SliTaz GNU/Linux'), Platform(id='solaris', name='Solaris'), Platform(id='sourcemage', name='Source Mage GNU/Linux'), Platform(id='sunos', name='SunOS'), Platform(id='tuxedo', name='Tuxedo OS'), Platform(id='ubuntu', name='Ubuntu'), Platform(id='ultramarine', name='Ultramarine'), Platform(id='void', name='Void Linux'), Platform(id='windows', name='Windows'), Platform(id='wsl1', name='Windows Subsystem for Linux v1'), Platform(id='wsl2', name='Windows Subsystem for Linux v2'), Platform(id='xenserver', name='XenServer')})¶
List of platforms supported by the manager.
Allows for a mishmash of platforms and groups of platforms. Will be normalized into a
frozensetofPlatforminstances at instantiation.
- requirement: str | None = '>=3.9.1'¶
The release adding
--no-project, which is what pins every read to the machine instead of to the working directory’s project tree.
- pre_args: tuple[str, ...] = ('--no-project',)¶
Ignore any project tree found by walking up from the working directory, so the inventory describes the machine and not the current directory.
- version_regexes: tuple[str, ...] = ('luarocks(?:\\.exe)?[ \\t]+(?P<version>\\d+\\.\\d+(?:\\.\\d+)?)',)¶
Search the version right after the binary path LuaRocks echoes back.
$ luarocks --version /opt/homebrew/bin/luarocks 3.13.0 LuaRocks main command-line interface
The path is printed in full and varies per host, so the pattern anchors on the binary name rather than on the start of the line.
- cli_names: tuple[str, ...] = ('luarocks',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- id: str = 'luarocks'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- property installed: Iterator[Package]¶
Fetch installed packages.
$ luarocks --no-project list --porcelain inspect 3.1.2-0 installed /Users/kde/.luarocks/lib/luarocks/rocks-5.5 say 1.4.1-3 installed /Users/kde/.luarocks/lib/luarocks/rocks-5.5
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- property outdated: Iterator[Package]¶
Fetch outdated packages.
$ luarocks --no-project list --outdated --porcelain inspect 3.1.2-0 3.1.3-0 https://luarocks.org
- search(query, extended, exact)[source]¶
Fetch matching packages.
Caution
Search does not support extended or exact matching.
$ luarocks --no-project search say --porcelain say 1.4.1-3 rockspec https://luarocks.org say 1.4.1-3 src https://luarocks.org say 1.4.0-1 rockspec https://luarocks.org say 1.4.0-1 src https://luarocks.org say 1.3-1 rockspec https://luarocks.org
- install(package_id, version=None)[source]¶
Install one package.
$ luarocks --no-project install inspect inspect 3.1.3-0 depends on lua >= 5.1 (5.5-1 provided by VM: success) No existing manifest. Attempting to rebuild... inspect 3.1.3-0 is now installed in /opt/homebrew (license: MIT <http://opensource.org/licenses/MIT>)
- Return type:
- upgrade_one_cli(package_id, version=None)[source]¶
Generate the CLI to upgrade one package.
LuaRocks has no
upgradeverb: installing a rock that is already present replaces it with the newer build, which is the upgrade.$ luarocks --no-project install inspect inspect 3.1.3-0 depends on lua >= 5.1 (5.5-1 provided by VM: success) No existing manifest. Attempting to rebuild... inspect 3.1.3-0 is now installed in /opt/homebrew (license: MIT <http://opensource.org/licenses/MIT>)
- remove(package_id)[source]¶
Remove one package.
Acts on the default tree, so a rock held in another one is refused by name rather than removed, as covered in the class notes above.
$ luarocks --no-project remove inspect Checking stability of dependencies in the absence of inspect 3.1.3-0... Removing inspect 3.1.3-0... Removal successful.
- Return type: