Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mentors.debian.net
debexpo
Commits
f8c18e69
Verified
Commit
f8c18e69
authored
Nov 06, 2021
by
Baptiste Beauplat
Browse files
Make args from GnuPG._run() mandatory
Since the default arguments have no action, an optional args doesn't make sense.
parent
c9f16579
Changes
1
Show whitespace changes
Inline
Side-by-side
debexpo/tools/gnupg.py
View file @
f8c18e69
...
@@ -110,7 +110,7 @@ class GnuPG():
...
@@ -110,7 +110,7 @@ class GnuPG():
"""
"""
try
:
try
:
(
output
,
status
)
=
self
.
_run
(
args
=
[
'--list-keys'
])
(
output
,
status
)
=
self
.
_run
([
'--list-keys'
])
keys
=
KeyData
.
read_from_gpg
(
output
.
splitlines
())
keys
=
KeyData
.
read_from_gpg
(
output
.
splitlines
())
return
list
(
keys
.
values
())
return
list
(
keys
.
values
())
...
@@ -126,8 +126,8 @@ class GnuPG():
...
@@ -126,8 +126,8 @@ class GnuPG():
``signed_file``
``signed_file``
path to signed file
path to signed file
"""
"""
args
=
(
'--verify'
,
signed_file
)
args
=
[
'--verify'
,
signed_file
]
(
output
,
status
)
=
self
.
_run
(
args
=
args
)
(
output
,
status
)
=
self
.
_run
(
args
)
output
=
output
.
splitlines
()
output
=
output
.
splitlines
()
err_sig_re
=
re
.
compile
(
r
'\[GNUPG:\] ERRSIG (?P<long_id>\w+)'
err_sig_re
=
re
.
compile
(
r
'\[GNUPG:\] ERRSIG (?P<long_id>\w+)'
...
@@ -172,7 +172,7 @@ class GnuPG():
...
@@ -172,7 +172,7 @@ class GnuPG():
"""
"""
args
=
[
'--import-options'
,
'import-minimal'
,
'--import'
]
args
=
[
'--import-options'
,
'import-minimal'
,
'--import'
]
(
output
,
status
)
=
self
.
_run
(
args
=
args
,
stdin
=
data
)
(
output
,
status
)
=
self
.
_run
(
args
,
stdin
=
data
)
if
status
and
output
and
len
(
output
.
splitlines
())
>
0
:
if
status
and
output
and
len
(
output
.
splitlines
())
>
0
:
raise
ExceptionGnuPG
(
_
(
'Cannot add key:'
raise
ExceptionGnuPG
(
_
(
'Cannot add key:'
...
@@ -180,7 +180,7 @@ class GnuPG():
...
@@ -180,7 +180,7 @@ class GnuPG():
return
(
output
,
status
)
return
(
output
,
status
)
def
_run
(
self
,
stdin
=
None
,
args
=
None
):
def
_run
(
self
,
args
,
stdin
=
None
):
"""
"""
Run gpg with the given stdin and arguments and return the output and
Run gpg with the given stdin and arguments and return the output and
exit status.
exit status.
...
@@ -214,10 +214,7 @@ class GnuPG():
...
@@ -214,10 +214,7 @@ class GnuPG():
'--trust-model'
,
'always'
,
'--trust-model'
,
'always'
,
'--with-colons'
,
'--with-colons'
,
'--with-fingerprint'
'--with-fingerprint'
]
]
+
args
if
args
is
not
None
:
cmd
.
extend
(
args
)
try
:
try
:
output
=
debexpo_exec
(
self
.
gpg_path
,
cmd
,
env
=
env
,
output
=
debexpo_exec
(
self
.
gpg_path
,
cmd
,
env
=
env
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment