Skip to content

Commit

Permalink
repoquery: move the alldeps/exactdeps check to configure()
Browse files Browse the repository at this point in the history
Moves the check for alldeps/exactdeps switches to the configure() method
along with the other checks.

Raises dnf.cli.CliError instead of dnf.exceptions.Error.

Closes: #1432
Approved by: j-mracek
  • Loading branch information
Lukáš Hrázký authored and inknos committed May 7, 2020
1 parent 3b55dd2 commit 6fe8442
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dnf/cli/commands/repoquery.py
Expand Up @@ -303,6 +303,12 @@ def configure(self):
"(optionally with '--alldeps', but not with '--exactdeps'), or with "
"'--requires <REQ> --resolve'"))

if self.opts.alldeps or self.opts.exactdeps:
if not (self.opts.whatrequires or self.opts.whatdepends):
raise dnf.cli.CliError(
_("argument {} requires --whatrequires or --whatdepends option".format(
'--alldeps' if self.opts.alldeps else '--exactdeps')))

if self.opts.srpm:
self.base.repos.enable_source_repos()

Expand Down Expand Up @@ -496,10 +502,6 @@ def run(self):
else:
q.filterm(file__glob=self.opts.whatprovides)
if self.opts.alldeps or self.opts.exactdeps:
if not (self.opts.whatrequires or self.opts.whatdepends):
raise dnf.exceptions.Error(
_("argument {} requires --whatrequires or --whatdepends option".format(
'--alldeps' if self.opts.alldeps else '--exactdeps')))
if self.opts.alldeps:
q = self.by_all_deps(self.opts.whatrequires, self.opts.whatdepends, q)
else:
Expand Down

0 comments on commit 6fe8442

Please sign in to comment.