diff options
author | James Turner <jturner@gemini.edu> | 2019-03-28 15:36:56 -0400 |
---|---|---|
committer | James Turner <jturner@gemini.edu> | 2019-03-28 15:36:56 -0400 |
commit | ef8c2b71e2fc65d1eec25359205888c92a6e2e8c (patch) | |
tree | 0d8addfe4e180ad0bb261004a2b73e072b90aa3c /scripts/ac_update_extern_pkg | |
parent | 7bf391ce6150e43b039d9ba499df68e72e5725bb (diff) | |
download | astroconda-iraf-helpers-ef8c2b71e2fc65d1eec25359205888c92a6e2e8c.tar.gz |
Fixes for changes to regular expression behaviour in Python 3.7.
Diffstat (limited to 'scripts/ac_update_extern_pkg')
-rw-r--r-- | scripts/ac_update_extern_pkg | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/ac_update_extern_pkg b/scripts/ac_update_extern_pkg index 9c751a5..dd918c2 100644 --- a/scripts/ac_update_extern_pkg +++ b/scripts/ac_update_extern_pkg @@ -1,4 +1,4 @@ -# Copyright(c) 2016 Association of Universities for Research in Astronomy, Inc. +# Copyright(c) 2016-2019 Association of Universities for Research in Astronomy, Inc. # This script uses the OS Python (both the LSB and MacOS define Python in # /usr/bin as standard), avoiding dependence on the installation that is still @@ -86,7 +86,7 @@ replacements = ( ('lead_space', (r'^[ \t]+', r'')), ('end_space', (r'[ \t]+$', r'')), ('extra_space', (r'[ \t]+', r'[ \t]+')), - ('line_space', (r'\s*\n\s*', r'\s*\n\s*')), # see below + ('line_space', (r'\s*\n\s*', r'\\s*\n\\s*')), # see below ('path_sub', (path_sub, r'.*')), ) repdict = dict(replacements) # keep both because no OrderedDict in python < 2.7 @@ -127,10 +127,13 @@ if match: # Make sure what goes before the "keep" ends with a new line (unless empty): if buffer.strip(): - sep = '\n' + sep = '\n' else: sep = '' -buffer = re.compile('\n?\Z', flags=re.M).sub(sep, buffer) +if buffer.endswith('\n'): + buffer = buffer[:-1] + sep +else: + buffer += sep # Find the last entry in extern.pkg (if any) that matches the template: match = None |