meta_package_manager.managers.scoop module

class meta_package_manager.managers.scoop.Scoop[source]

Bases: PackageManager

Scoop is a user-level command-line installer for Windows.

Apps unpack under ~/scoop without elevation, so no operation is marked sudo.

Documentation: ScoopInstaller/Scoop.

Note

The installed, outdated and search listings are column tables introduced by a --- separator line: mpm drops everything up to that separator, then splits each row positionally on whitespace.

Attention

scoop --version does not reliably print a clean version: it often emits the raw git log line of the checkout instead. The probe therefore carries fallbacks that recover the version from a tag: vX.Y.Z ref or a Bump to version commit subject. See Scoop’s own version-reporting issue.

Caution

remove uninstalls with --purge, so a package’s persisted data directory is deleted with it rather than kept for a later reinstall.

Initialize cli_errors list.

name: str = 'Scoop'

Return package manager’s common name.

Default value is based on class name.

homepage_url: str | None = 'https://scoop.sh'

Home page of the project, only used in documentation for reference.

platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='windows', name='Windows')})

List of platforms supported by the manager.

Allows for a mishmash of platforms and groups of platforms. Will be normalized into a frozenset of Platform instances at instantiation.

requirement: str | None = '>=0.2.4'

Version requirement specifier.

Supports a comma-separated range of constraints (e.g. ">=1.20.0,<2.0.0"). A bare version string like "1.20.0" is treated as >=1.20.0.

Parsed by meta_package_manager.version.VersionRange.

Defaults to None, which deactivates version check entirely.

version_regexes: tuple[str, ...] = ('^v(?P<version>\\S+)\\s.+', '^.+,\\stag:\\sv(?P<version>\\S+),\\s.+', '^.+\\sBump\\sto\\sversion\\s(?P<version>\\S+)\\s.+')

Search version at the start of a line.

> scoop --version
Current Scoop version:
v0.2.4 - Released at 2022-08-08

'main' bucket:
5a5b13b6c (HEAD -> master, origin/HEAD) oh-my-posh: Update to version 11.1.1

Attention

Scoop does not always provide a clean version string.

So we fallback on parsing various git log output:

> scoop --version
Current Scoop version:
b588a06e (HEAD -> master, tag: v0.5.3, origin/master, origin/HEAD) Bump 0.5.3

'main' bucket:
46c50c6b0 (HEAD -> master, origin/master, origin/HEAD) fix arm64 version
> scoop --version
Current Scoop version:
b588a06e chore(release): Bump to version 0.5.3 (resync) (#6436)

'main' bucket:
46c50c6b0 aqua: fix arm64 version (#7071)
static remove_headers(text)[source]
Return type:

str

property installed: Iterator[Package]

Fetch installed packages.

>  scoop list
Installed apps:

Name   Version          Source Updated             Info
----   -------          ------ -------             ----
7zip   22.01            main   2022-09-27 08:03:30
dark   3.11.2           main   2022-09-27 08:04:26
git    2.37.3.windows.1 main   2022-09-27 08:03:58
python 3.10.7           main   2022-09-27 08:04:53
property outdated: Iterator[Package]

Fetch outdated packages.

> scoop status
Name           Installed Version Latest Version Missing Dependencies Info
----           ----------------- -------------- -------------------- ----
demulshooter   16.7.2            18.7.3
eduke32        20220611-10112    20220709-10115
Teracopy-np
yuzu-pineapple EA-2804           EA-2830
search(query, extended, exact)[source]

Fetch matching packages.

Caution

Search does not support extended or exact matching. So we return the best subset of results and let meta_package_manager.manager.PackageManager.refiltered_search() refine them.

> scoop search zip
Results from local buckets...

Name             Version         Source Binaries
----             -------         ------ --------
7zip             22.01           main
7zip19.00-helper 19.00           main
busybox          4716-g31467ddfc main   bunzip2 | gunzip | gzip | unzip
bzip2            1.0.8.0         main
gow              0.8.0           main   bunzip2.exe | bzip2.exe | zip.exe
gzip             1.3.12          main
lzip             1.20            main
unzip            6.00            main
zip              3.0             main
Return type:

Iterator[Package]

install(package_id, version=None)[source]

Install one package.

> scoop install 7zip
Installing '7zip' (22.01) [64bit] from main bucket
7z2201-x64.msi (1.8 MB) [====================] 100%
Checking hash of 7z2201-x64.msi ... ok.
Extracting 7z2201-x64.msi ... done.
Linking ~\scoopppszip\current => ~\scoopppszip.01
Creating shim for '7z'.
Creating shortcut for 7-Zip (7zFM.exe)
Persisting Codecs
Persisting Formats
Running post_install script...
'7zip' (22.01) was installed successfully!

Notes
-----
Add 7-Zip as a context menu by running: "C:\scoop\...install-context.reg"
Return type:

str

upgrade_all_cli()[source]

Generates the CLI to upgrade all outdated packages.

> scoop update --all
Return type:

tuple[str, ...]

upgrade_one_cli(package_id, version=None)[source]

Generates the CLI to upgrade the provided package.

> scoop update 7zip
Return type:

tuple[str, ...]

remove(package_id)[source]

Remove one package.

> scoop uninstall 7zip --purge
Uninstalling '7zip' (22.01).
Removing shim '7z.shim'.
Removing shim '7z.exe'.
Removing shortcut ~\AppData\Roaming\Scoop Apps-Zip.lnk
Unlinking ~\scoopppszip\current
'7zip' was uninstalled.
Return type:

str

sync()[source]

Sync package metadata.

> scoop status
WARN  Scoop out of date. Run 'scoop update' to get the latest changes.
> scoop update
Updating Scoop...
Updating 'main' bucket...
Converting 'main' bucket to git repo...
Checking repo... OK
The main bucket was added successfully.
Scoop was updated successfully!
> scoop status
Scoop is up to date.
Everything is ok!
Return type:

None

cleanup_cache()[source]

Removes things we don’t need anymore.

> scoop cleanup --all --cache
Everything is shiny now!
Return type:

None

cli_names: tuple[str, ...] = ('scoop',)

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 python or python3.

By default, this property’s value is derived from the manager’s ID (see the MetaPackageManager.__init__ method above).

doctor_cli()[source]

Generates the CLI running the native self-diagnosis.

Caution

checkup prints its suggestions but is optimistic with its exit code, so an unhealthy setup may still report as : the relayed report is the signal to read.

> scoop checkup
Return type:

tuple[str, ...]

id: str = 'scoop'

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.

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.