in export/securedrop_export/print/service.py [0:0]
def _install_printer_ppd(self, uri):
if not any(x in uri for x in self.SUPPORTED_PRINTERS):
logger.error(f"Cannot install printer ppd for unsupported printer: {uri}")
raise ExportException(sdstatus=Status.ERROR_PRINTER_NOT_SUPPORTED)
if self.BROTHER in uri:
printer_driver = self.BRLASER_DRIVER
printer_ppd = self.BRLASER_PPD
elif self.LASERJET in uri:
printer_driver = self.LASERJET_DRIVER
printer_ppd = self.LASERJET_PPD
# Compile and install drivers that are not already installed
if not os.path.exists(printer_ppd):
logger.info("Installing printer drivers")
self.check_output_and_stderr(
command=[
"sudo",
"ppdc",
printer_driver,
"-d",
"/usr/share/cups/model/",
],
error_status=Status.ERROR_PRINTER_DRIVER_UNAVAILABLE,
ignore_stderr_startswith=b"ppdc: Warning",
)
return printer_ppd