Use get_packit_api in create-update CLI function
@@ -3,20 +3,16 @@ import os
import click
-from packit.api import PackitAPI
from packit.cli.types import LocalProjectParameter
-from packit.cli.utils import cover_packit_exception
-from packit.config import pass_config, get_context_settings, get_local_package_config
+from packit.cli.utils import cover_packit_exception, get_packit_api
+from packit.config import pass_config, get_context_settings
from packit.constants import DEFAULT_BODHI_NOTE
logger = logging.getLogger(__file__)
@click.command("create-update", context_settings=get_context_settings())
-@click.option(
- "--dist-git-branch",
- help="Target branch in dist-git to release into.",
-)
+@click.option("--dist-git-branch", help="Target branch in dist-git to release into.")
@click.option(
"--koji-build",
help="Koji build to add to the bodhi update (can be specified multiple times)",
@@ -36,7 +32,7 @@ logger = logging.getLogger(__file__)
type=click.types.Choice(("security", "bugfix", "enhancement", "newpackage")),
help="Type of the bodhi update",
required=False,
- default="enhancement"
+ default="enhancement",
)
@click.argument(
"repo", type=LocalProjectParameter(), default=os.path.abspath(os.path.curdir)
@@ -50,8 +46,10 @@ def create_update(config, dist_git_branch, koji_build, update_notes, update_type
REPO argument is a local path to the upstream git repository,
it defaults to the current working directory
"""
- package_config = get_local_package_config(directory=repo.working_dir)
- package_config.upstream_project_url = repo.working_dir
- api = PackitAPI(config=config, package_config=package_config)
- api.create_update(koji_builds=koji_build, dist_git_branch=dist_git_branch,
- update_notes=update_notes, update_type=update_type)
+ api = get_packit_api(config=config, repo=repo)
+ api.create_update(
+ koji_builds=koji_build,
+ dist_git_branch=dist_git_branch,
+ update_notes=update_notes,
+ update_type=update_type,
+ )
