mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-12-11 18:13:26 +00:00
Modernize SourcePackage._run_lintian()
This commit is contained in:
parent
5e2f94cdb4
commit
38988ed183
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import pathlib
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@ -407,7 +408,7 @@ class SourcePackage:
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _run_lintian(self):
|
def _run_lintian(self) -> str:
|
||||||
"""Runs lintian on either the source or binary changes file.
|
"""Runs lintian on either the source or binary changes file.
|
||||||
|
|
||||||
Returns the filename of the created lintian output file.
|
Returns the filename of the created lintian output file.
|
||||||
@ -424,16 +425,12 @@ class SourcePackage:
|
|||||||
# Check lintian
|
# Check lintian
|
||||||
assert os.path.isfile(changes_for_lintian), f"{changes_for_lintian} does not exist."
|
assert os.path.isfile(changes_for_lintian), f"{changes_for_lintian} does not exist."
|
||||||
cmd = ["lintian", "-IE", "--pedantic", "-q", "--profile", "ubuntu", changes_for_lintian]
|
cmd = ["lintian", "-IE", "--pedantic", "-q", "--profile", "ubuntu", changes_for_lintian]
|
||||||
lintian_filename = os.path.join(self._workdir, f"{package_and_version}.lintian")
|
lintian_file = pathlib.Path(self._workdir) / f"{package_and_version}.lintian"
|
||||||
Logger.debug("%s > %s", " ".join(cmd), lintian_filename)
|
Logger.debug("%s > %s", " ".join(cmd), lintian_file)
|
||||||
report = subprocess.check_output(cmd, encoding="utf-8")
|
with lintian_file.open("wb") as outfile:
|
||||||
|
subprocess.run(cmd, stdout=outfile, check=True)
|
||||||
|
|
||||||
# write lintian report file
|
return str(lintian_file)
|
||||||
lintian_file = open(lintian_filename, "w", encoding="utf-8")
|
|
||||||
lintian_file.writelines(report)
|
|
||||||
lintian_file.close()
|
|
||||||
|
|
||||||
return lintian_filename
|
|
||||||
|
|
||||||
def sync(self, upload, series, bug_number, requester):
|
def sync(self, upload, series, bug_number, requester):
|
||||||
"""Does a sync of the source package."""
|
"""Does a sync of the source package."""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user