ghostscript: avoid log=None construct

This commit is contained in:
James R. Barlow
2019-05-30 13:57:38 -07:00
parent db29cae177
commit 8ed4e229f3
4 changed files with 19 additions and 8 deletions
+10 -1
View File
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
import logging
import re
from functools import lru_cache
from os import fspath
@@ -24,8 +25,11 @@ from tempfile import NamedTemporaryFile
from PIL import Image
from . import get_version
from ..exceptions import SubprocessOutputError
from . import get_version
gslog = logging.getLogger()
@lru_cache(maxsize=1)
@@ -132,6 +136,8 @@ def rasterize_pdf(
res = round(xres, 6), round(yres, 6)
if not page_dpi:
page_dpi = res
if not log:
log = gslog
with NamedTemporaryFile(delete=True) as tmp:
args_gs = (
@@ -209,6 +215,9 @@ def generate_pdfa(
images entirely. (The feature was added in 9.23 but broken, and the 9.24
release of Ghostscript had regressions, so we don't support it until 9.25.)
"""
if not log:
log = gslog
compression_args = []
if compression == 'jpeg':
compression_args = [