From 054dfe3c00c6431f380d46e981e70737932954a9 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 18 Jan 2011 15:37:20 +0000 Subject: [PATCH] Improve the prefs2prefs scripts a bit. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37250 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/scripts/prefs2prefs.py | 7 ++++--- lib/scripts/prefs2prefs_lfuns.py | 2 -- lib/scripts/prefs2prefs_prefs.py | 2 -- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/scripts/prefs2prefs.py b/lib/scripts/prefs2prefs.py index bdbc7e327a..eaf39fd015 100644 --- a/lib/scripts/prefs2prefs.py +++ b/lib/scripts/prefs2prefs.py @@ -100,7 +100,7 @@ def update_format(lines): " Writes new format line " (found, format_line) = find_format_line(lines) if not found: - lines.insert(format_line, "Format 1") + lines[format_line:format_line] = ("Format 1", "") return line = lines[format_line] @@ -149,15 +149,16 @@ def main(argv): for (opt, param) in options: if opt == "-l": - from prefs2prefs_lfuns import conversions, current_format + from prefs2prefs_lfuns import conversions elif opt == "-p": - from prefs2prefs_prefs import conversions, current_format + from prefs2prefs_prefs import conversions if not conversions: usage() print "\nNeither -l nor -p given" sys.exit(1) + current_format = len(conversions) lines = read(source) format = get_format(lines) diff --git a/lib/scripts/prefs2prefs_lfuns.py b/lib/scripts/prefs2prefs_lfuns.py index 55a95edc8a..f188f7f407 100644 --- a/lib/scripts/prefs2prefs_lfuns.py +++ b/lib/scripts/prefs2prefs_lfuns.py @@ -20,8 +20,6 @@ import sys, re -current_format = 1 - ########################################################### # # Actual converter functions diff --git a/lib/scripts/prefs2prefs_prefs.py b/lib/scripts/prefs2prefs_prefs.py index fba36cf279..dab1d81cc8 100644 --- a/lib/scripts/prefs2prefs_prefs.py +++ b/lib/scripts/prefs2prefs_prefs.py @@ -17,8 +17,6 @@ # the new line, if so, which will be used to replace the old line. -current_format = 1 - ########################################################### # # Conversion chain -- 2.39.5