Use get_packit_api in build CLI function
@@ -3,10 +3,9 @@ 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
logger = logging.getLogger(__file__)
@@ -23,10 +22,7 @@ logger = logging.getLogger(__file__)
"Otherwise clone the repo in a temporary directory.",
)
@click.option(
- "--scratch",
- is_flag=True,
- default=False,
- help="Submit a scratch koji build"
+ "--scratch", is_flag=True, default=False, help="Submit a scratch koji build"
)
@click.argument(
"repo", type=LocalProjectParameter(), default=os.path.abspath(os.path.curdir)
@@ -42,8 +38,5 @@ def build(config, dist_git_path, dist_git_branch, scratch, repo):
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.downstream_project_url = dist_git_path
- package_config.upstream_project_url = repo.working_dir
- api = PackitAPI(config=config, package_config=package_config)
+ api = get_packit_api(config=config, dist_git_path=dist_git_path, repo=repo)
api.build(dist_git_branch, scratch=scratch)
