Verified Commit e85d0d89 authored by Baptiste Beauplat's avatar Baptiste Beauplat
Browse files

Use text=True as default for debexpo_exec

parent fcb2642c
...@@ -63,8 +63,7 @@ def get_debexpo_version(): ...@@ -63,8 +63,7 @@ def get_debexpo_version():
# currently are in a git reposirtory. Hence, this is tested manually. # currently are in a git reposirtory. Hence, this is tested manually.
try: try:
output = debexpo_exec(command, args, output = debexpo_exec(command, args,
cwd=dirname(abspath(__file__)), cwd=dirname(abspath(__file__)))
text=True)
except FileNotFoundError: # pragma: no cover except FileNotFoundError: # pragma: no cover
log.debug('git not found, skip revision detection.') log.debug('git not found, skip revision detection.')
except CalledProcessError: # pragma: no cover except CalledProcessError: # pragma: no cover
......
...@@ -43,8 +43,7 @@ class PluginDiffClean(BasePlugin): ...@@ -43,8 +43,7 @@ class PluginDiffClean(BasePlugin):
def _run_diffstat(self, diff_file): def _run_diffstat(self, diff_file):
try: try:
output = debexpo_exec("diffstat", ["-p1", diff_file], output = debexpo_exec("diffstat", ["-p1", diff_file],
cwd=dirname(diff_file), cwd=dirname(diff_file))
text=True)
except FileNotFoundError: # pragma: no cover except FileNotFoundError: # pragma: no cover
self.failed('diffstat not found') self.failed('diffstat not found')
# Looking at diffstat code, it only exit with a return code different # Looking at diffstat code, it only exit with a return code different
......
...@@ -68,8 +68,7 @@ class PluginLintian(BasePlugin): ...@@ -68,8 +68,7 @@ class PluginLintian(BasePlugin):
# run as root in CI. # run as root in CI.
"--allow-root", "--allow-root",
str(changes)], str(changes)],
cwd=dirname(changes.filename), cwd=dirname(changes.filename))
text=True)
except FileNotFoundError: # pragma: no cover except FileNotFoundError: # pragma: no cover
self.failed('lintian not found') self.failed('lintian not found')
except TimeoutExpired: except TimeoutExpired:
......
...@@ -48,8 +48,7 @@ class PluginWatchFile(BasePlugin): ...@@ -48,8 +48,7 @@ class PluginWatchFile(BasePlugin):
def _run_uscan(self, source): def _run_uscan(self, source):
try: try:
output = debexpo_exec("uscan", ["--dehs", '--report'], output = debexpo_exec("uscan", ["--dehs", '--report'],
cwd=source.get_source_dir(), cwd=source.get_source_dir())
text=True)
except FileNotFoundError: # pragma: no cover except FileNotFoundError: # pragma: no cover
self.failed('uscan not found') self.failed('uscan not found')
except CalledProcessError as e: except CalledProcessError as e:
......
...@@ -57,8 +57,7 @@ class Source(): ...@@ -57,8 +57,7 @@ class Source():
try: try:
debexpo_exec('dpkg-source', args, debexpo_exec('dpkg-source', args,
stderr=STDOUT, stderr=STDOUT,
cwd=dirname(self.dsc.filename), cwd=dirname(self.dsc.filename))
text=True)
except FileNotFoundError: # pragma: no cover except FileNotFoundError: # pragma: no cover
log.error('dpkg-source not found') log.error('dpkg-source not found')
raise ExceptionSource('Internal error. Please contact debexpo ' raise ExceptionSource('Internal error. Please contact debexpo '
......
...@@ -225,7 +225,7 @@ class GnuPG(): ...@@ -225,7 +225,7 @@ class GnuPG():
try: try:
output = debexpo_exec(self.gpg_path, cmd, env=env, output = debexpo_exec(self.gpg_path, cmd, env=env,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
input=str(stdin), text=True) input=str(stdin))
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
return (e.output, e.returncode) return (e.output, e.returncode)
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
......
...@@ -38,4 +38,7 @@ def debexpo_exec(command, args, **kwargs): ...@@ -38,4 +38,7 @@ def debexpo_exec(command, args, **kwargs):
f'{basename(command).replace("-", "_").upper()}', f'{basename(command).replace("-", "_").upper()}',
getattr(settings, 'SUBPROCESS_TIMEOUT', None)) getattr(settings, 'SUBPROCESS_TIMEOUT', None))
return check_output([command] + args, timeout=timeout, **kwargs) return check_output([command] + args,
timeout=timeout,
text=True,
**kwargs)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment