swh.lister.opam.lister module#
- swh.lister.opam.lister.opam() str [source]#
Get the path to the opam executable.
- Raises:
EnvironmentError if no opam executable is found –
- class swh.lister.opam.lister.OpamLister(scheduler: SchedulerInterface, url: str, instance: str | None = None, credentials: Dict[str, Dict[str, List[Dict[str, str]]]] | None = None, max_origins_per_page: int | None = None, max_pages: int | None = None, enable_origins: bool = True, opam_root: str = '/tmp/opam/')[source]#
Bases:
StatelessLister
[str
]List all repositories hosted on an opam repository.
On initialisation, we create an opam root, with no ocaml compiler (no switch) as we won’t need it and it’s costly. In this opam root, we add a single opam repository (url) and give it a name (instance). Then, to get pages, we just ask opam to list all the packages for our opam repository in our opam root.
- Parameters:
url – base URL of an opam repository (for instance https://opam.ocaml.org)
instance – string identifier for the listed repository
- get_pages() Iterator[str] [source]#
Retrieve a list of pages of listed results. This is the main loop of the lister.
- Returns:
an iterator of raw pages fetched from the platform currently being listed.
- get_origins_from_page(page: str) Iterator[ListedOrigin] [source]#
Convert a page of OpamLister repositories into a list of ListedOrigins
- swh.lister.opam.lister.opam_init(opam_root: str, instance: str, url: str, env: Dict[str, Any]) None [source]#
Initialize an opam_root folder.
- Parameters:
opam_root – The opam root folder to initialize
instance – Name of the opam repository to add or initialize
url – The associated url of the opam repository to add or initialize
env – The global environment to use for the opam command.
- Returns:
None.