On Monday, February 15, 2021 3:25:45 PM WET Scott Kostyshak wrote:
> +1
>
> Thanks for taking a look, José.
>
> Scott
OK. I have lots of issues on hand but at least this is funny. :-)
One option would be to use some kind of string formatting. Actually since
curly braces are usually not used in OS we could use the string format syntax
(that is also used in C++20 format). One example would be:
\converter pdf4 pdf8 "{python} $$s/scripts/convert_pdf.py $$i $$o ebook"...
The lyx could convert internally {python} to the python path. Since lyx
already has this information, or else it would not call configure.py
If you do not like this option one in the same line as the other
interpolations that we apply is to use $${python}.
The other option is to replace this in configure.py like in the following
patch that I have not yet tested.
What do you think?
--
José Abíliodiff --git a/lib/configure.py b/lib/configure.py
index 43073e901d..4e08ef6776 100644
--- a/lib/configure.py
+++ b/lib/configure.py
@@ -29,7 +29,10 @@ formatter = logging.Formatter('%(message)s') # only print out the message itself
console.setFormatter(formatter)
logger = logging.getLogger('LyX')
logger.addHandler(console)
-
+interpreter = sys.executable
+if interpreter == '':
+interpreter = "python"
+
def quoteIfSpace(name):
" utility function: quote name if it contains spaces "
if ' ' in name:
@@ -52,7 +55,7 @@ def addToRC(lines):
add newline at the end of lines.
'''
if lines.strip():
-writeToFile(outfile, lines + '\n', append = True)
+writeToFile(outfile, lines.format(python=interpreter) + '\n', append = True)
logger.debug('Add to RC:\n' + lines + '\n\n')
@@ -653,7 +656,7 @@ def checkLatex(dtl_tools):
if dtl_tools:
# Windows only: DraftDVI
addToRC(r'''\converter latex dvi2 "%s" "latex,hyperref-driver=dvips"
-\converter dvi2 dvi"python -tt $$s/scripts/clean_dvi.py $$i $$o" ""''' % LATEX)
+\converter dvi2 dvi"{python} $$s/scripts/clean_dvi.py $$i $$o" ""''' % LATEX)
else:
addToRC(r'\converter latex dvi"%s" "latex,hyperref-driver=dvips"' % LATEX)
# no latex
@@ -943,7 +946,7 @@ def checkConverterEntries():
checkProg('an HTML -> LaTeX converter', ['html2latex $$i', 'gnuhtml2latex',
'htmltolatex -input $$i -output $$o', 'htmltolatex.jar -input $$i -output $$o'],
rc_entry = [ r'\converter html latex "%%" ""',
- r'\converter html latex "python -tt $$s/scripts/html2latexwrapper.py %% $$i $$o" ""',
+ r'\converter html latex "{python} $$s/scripts/html2latexwrapper.py %% $$i $$o" ""',
r'\converter html latex "%%" ""',
r'\converter html latex "%%" ""', '' ])
#
@@ -964,8 +967,8 @@ def checkConverterEntries():
['elyxer.py --html --nofooter --unicode --directory $$r $$i $$o', 'elyxer --html --nofooter --unicode --directory $$r $$i $$o'],
rc_entry = [ r'\converter lyx word "%%" ""' ])
if elyxer.find('elyxer') >= 0:
- addToRC(r'''\copierhtml "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
- addToRC(r'''\copierwordhtml "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
+ addToRC(r'''\copierhtml "{python} $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
+ addToRC(r'''\copierwordhtml "{python} $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
else:
# search for HTML converters other than eLyXer
# On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/
@@ -974,24 +977,24 @@ def checkConverterEntries():
'latex2html -no_subdir -split 0 -show_section_numbers $$i', 'hevea -s $$i'],
rc_entry = [ r'\converter latex html "%%" "needaux"' ])
if htmlconv.find('htlatex') >= 0 or htmlconv == 'latex2html':
-addToRC(r'''\copierhtml "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
+addToRC(r'''\copierhtml "{python} $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''')
else:
-addToRC(r'''\copierhtml "python -tt $$s/scripts/ext_copy.py $$i $$o"''')
+addToRC(r'''\copierhtml "{python} $$s/scripts/ext_copy.py $$i $$o"''')
path, htmlconv = checkProg('a LaTeX -> HTML (MS Word) converter', ["htlatex $$i 'html,word' 'symbol/!' '-cvalidate'",
"htlatex.sh $$i 'html,word' 'symbol/!' '-cvalidate'",
"/usr/share/tex4ht/htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"],
rc_entry = [ r'\converter latex wordhtml "%%" "needaux"' ])
if htmlconv.find('htlatex') >= 0:
-addToRC(r'''\copierwordhtml "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i