From a6aebc801a4a8652e77f02d14f262374cb388371 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Mon, 29 Aug 2011 22:05:26 +0000 Subject: [PATCH] Fix bug #7718 (Configure fails if shell autorun commands are enabled in the registry) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@39565 a592a061-630c-0410-9148-cb99ea01b6c8 --- INSTALL | 4 +++- INSTALL.scons | 8 ++++---- README | 10 +++------- lib/configure.py | 28 +++++++++++++++++----------- status.20x | 3 +++ 5 files changed, 30 insertions(+), 23 deletions(-) diff --git a/INSTALL b/INSTALL index 694f1db050..e9ec832df1 100644 --- a/INSTALL +++ b/INSTALL @@ -77,7 +77,9 @@ The two following programs should be available at configuration time: as. Otherwise, LyX will not be able to run a number of tests. Note that users can run these tests manually with Tools>Reconfigure. - o Python 2.3 or newer installed to be able to import older LyX files + o Python 2.4 or newer must be installed. Python is used for many + simple tasks that are executed by external scripts, such as the + automatic configuration step and the import of older LyX documents with the lyx2lyx script (this script is called automatically when opening a file). Python 3.0 or later is not supported. diff --git a/INSTALL.scons b/INSTALL.scons index 561d23b6f8..0969efa7e4 100644 --- a/INSTALL.scons +++ b/INSTALL.scons @@ -30,10 +30,10 @@ Prerequisites: -------------- * Python: - Python >= 2.6.0 is required to run scons, but Python >= 2.3.4 is used by - lyx itself so the newer version is needed. Python is widely - available on non-windows systems. Windows users can download and install - python from http://www.python.org. + Python >= 2.6.0 is required to run scons, while LyX itself requires + Python >= 2.4.0 for scripts such as configure.py. Python is widely + available on non-windows systems. Windows users can download and + install python from http://www.python.org. * SCons: scons >= 1.1.0 is needed. You can either use a full system-wide scons diff --git a/README b/README index 645cee217e..4901cad631 100644 --- a/README +++ b/README @@ -33,13 +33,9 @@ What do I need to run LyX? A decent LaTeX2e installation (e.g. TeX Live for Linux, MikTeX for Windows). - Python 2.3 or later to convert old LyX files and for helper scripts. - Note 1: Python 2.3.4 or later is required for exporting LyX files - to a pre-unicode format, as previous versions are affected by a bug - about the normalization of unicode strings. - Note 2: Python 2.4.0 or later is required for the clean_dvi.py script, - which, however, is only used on Windows, where at least Python 2.6.0 - is anyway recommended. + Python 2.4 or later to convert old LyX files and for helper scripts. + Note 1: Python 2.4 or later is required due to the subprocess module. + Note 2: Python 2.6 or later is recommended on Windows. Note 3: Python 3.0 or later is not supported. How does the LyX version scheme work? diff --git a/lib/configure.py b/lib/configure.py index 575189021f..226a70d9b5 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -8,7 +8,7 @@ # \author Bo Peng # Full author contact details are available in file CREDITS. -import sys, os, re, shutil, glob, logging +import sys, os, re, shutil, glob, logging, subprocess # set up logging logging.basicConfig(level = logging.DEBUG, @@ -60,9 +60,16 @@ def cmdOutput(cmd): '''utility function: run a command and get its output as a string cmd: command to run ''' - fout = os.popen(cmd) - output = fout.read() - fout.close() + if os.name == 'nt': + b = False + cmd = 'cmd /d /c ' + cmd + else: + b = True + pipe = subprocess.Popen(cmd, shell=b, close_fds=b, stdin=subprocess.PIPE, \ + stdout=subprocess.PIPE, universal_newlines=True) + pipe.stdin.close() + output = pipe.stdout.read() + pipe.stdout.close() return output.strip() @@ -1135,15 +1142,14 @@ def checkLatexConfig(check_config, bool_docbook): cl.close() # # we have chklayouts.tex, then process it - fout = os.popen(LATEX + ' wrap_chkconfig.ltx') - while True: - line = fout.readline() - if not line: - break; + ret = 1 + latex_out = cmdOutput(LATEX + ' wrap_chkconfig.ltx') + for line in latex_out.splitlines(): if re.match('^\+', line): logger.info(line.strip()) - # if the command succeeds, None will be returned - ret = fout.close() + # return None if the command succeeds + if line == "+Inspection done.": + ret = None # # currently, values in chhkconfig are only used to set # \font_encoding diff --git a/status.20x b/status.20x index 2a4da55140..165c18197e 100644 --- a/status.20x +++ b/status.20x @@ -258,6 +258,9 @@ What's new - On Windows, fix call to Computer Algebra System programs (bug 7715). +- On Windows, fix configuration failure when shell autorun commands are + are enabled in the registry (bug 7718). + * ADVANCED FIND AND REPLACE -- 2.39.5