mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Python 3.13 removed the pipes module from the standard library
That module was a wrapper over the popen module and it was scheduled to
be removed in Python 3.11.
This code is also compatible with Python 2.
(cherry picked from commit d06a034578
)
This commit is contained in:
parent
fd9f09e517
commit
f95e238ccd
@ -79,7 +79,7 @@
|
|||||||
# If possible, the script will use pdftocairo instead of gs,
|
# If possible, the script will use pdftocairo instead of gs,
|
||||||
# as it's much faster and gives better results.
|
# as it's much faster and gives better results.
|
||||||
|
|
||||||
import glob, os, pipes, re, sys, tempfile
|
import glob, os, re, subprocess, sys, tempfile
|
||||||
|
|
||||||
from lyxpreview_tools import check_latex_log, copyfileobj, error, filter_pages,\
|
from lyxpreview_tools import check_latex_log, copyfileobj, error, filter_pages,\
|
||||||
find_exe, find_exe_or_terminate, join_metrics_and_rename, latex_commands, \
|
find_exe, find_exe_or_terminate, join_metrics_and_rename, latex_commands, \
|
||||||
@ -281,16 +281,15 @@ def legacy_latex_file(latex_file, fg_color, bg_color):
|
|||||||
|
|
||||||
|
|
||||||
def crop_files(pnmcrop, basename):
|
def crop_files(pnmcrop, basename):
|
||||||
t = pipes.Template()
|
|
||||||
t.append('%s -left' % pnmcrop, '--')
|
|
||||||
t.append('%s -right' % pnmcrop, '--')
|
|
||||||
|
|
||||||
for file in glob.glob("%s*.ppm" % basename):
|
for file in glob.glob("%s*.ppm" % basename):
|
||||||
tmp = tempfile.TemporaryFile()
|
tmp = tempfile.TemporaryFile()
|
||||||
new = t.open(file, "r")
|
conv_call = f'{pnmcrop} -left -right -- {file}'
|
||||||
copyfileobj(new, tmp)
|
conv_status = subprocess.run(conv_call, stdout=tmp)
|
||||||
if not new.close():
|
|
||||||
copyfileobj(tmp, open(file,"wb"), 1)
|
if conv_status:
|
||||||
|
continue
|
||||||
|
|
||||||
|
copyfileobj(tmp, open(file, "wb"), 1)
|
||||||
|
|
||||||
|
|
||||||
def legacy_conversion(argv, skipMetrics = False):
|
def legacy_conversion(argv, skipMetrics = False):
|
||||||
|
@ -119,6 +119,9 @@ What's new
|
|||||||
- Fix possible crash in undo code after inserting note inset over a
|
- Fix possible crash in undo code after inserting note inset over a
|
||||||
multi-paragraph selection.
|
multi-paragraph selection.
|
||||||
|
|
||||||
|
- Fix a Python script, used to preview math expressions, that used a
|
||||||
|
module that is removed in Python 3.13.
|
||||||
|
|
||||||
|
|
||||||
* DOCUMENTATION AND LOCALIZATION
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
|
||||||
@ -144,4 +147,3 @@ What's new
|
|||||||
* BUILD/INSTALLATION
|
* BUILD/INSTALLATION
|
||||||
|
|
||||||
- Fix 'make install' target for autotools builds with autoconf >= 2.72.
|
- Fix 'make install' target for autotools builds with autoconf >= 2.72.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user