Skip to content

Commit

Permalink
Add docstring
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Diblik <[email protected]>
  • Loading branch information
danmyway committed Mar 20, 2024
1 parent 492eb49 commit 4a0820b
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/dispatch/copr_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@


def get_info(package, repository, reference, composes):
"""
Get information about a COPR build for a specific package and reference.
Args:
package (str): The name of the package for which to get information.
repository (str): The name of the Copr repository containing the package build.
reference (str, int): The reference for the package build. This can be either a commit reference
(e.g., "master", "main") or a pull request ID (e.g., "pull/123").
composes (list): A list of strings representing the target distributions for the COPR build.
Returns:
tuple: A tuple containing two elements:
- A list of dictionaries containing build information for each target distribution.
- The build reference used for selecting the COPR build.
"""
owner = "@oamg"
info = []
build_reference = reference[0]
Expand All @@ -21,10 +36,16 @@ def get_info(package, repository, reference, composes):
if ARGS.reference:

def _get_correct_build_list():
"""
Get a clean list of COPR builds that match the specified reference.
Returns:
list: A list of COPR builds that match the specified reference.
"""
clean_build_list = []
query = SESSION.get_list(owner, repository)

if build_reference == "master" or build_reference == "main":
if build_reference in ["master", "main"]:
LOGGER.info(
f"Getting copr build info for referenced {build_reference}."
)
Expand Down Expand Up @@ -90,6 +111,20 @@ def _get_correct_build_list():
def get_build_dictionary(
build, repository, package, composes, source_release=None, target_release=None
):
"""
Get the dictionary containing build information for each target distribution.
Args:
build: The COPR build object.
repository (str): The COPR repository name.
package (str): The name of the package.
composes (list): A list of strings representing the target distributions for the COPR build.
source_release (str, optional): The source release version. Defaults to None.
target_release (str, optional): The target release version. Defaults to None.
Returns:
list: A list of dictionaries containing build information for each target distribution.
"""
build_info = []
build_baseurl = (
f"https://copr.fedorainfracloud.org/coprs/g/oamg/{repository}/build/"
Expand Down

0 comments on commit 4a0820b

Please sign in to comment.