-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add high-level repository reading API
Abstracts away a lot of manual logic around setup and state tracking.
- Loading branch information
Showing
3 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import sys | ||
import createrepo_c as cr | ||
|
||
REPO_PATH = "tests/testdata/repo_with_additional_metadata/" | ||
|
||
|
||
def parse_repository(path): | ||
reader = cr.RepositoryReader.from_path(path) | ||
|
||
for package in reader.iter_packages(): | ||
print("Package {}".format(package.nevra())) | ||
|
||
for advisory in reader.advisories(): | ||
print("Advisory {}".format(advisory.id)) | ||
|
||
|
||
if __name__ == "__main__": | ||
parse_repository(REPO_PATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters