summaryrefslogtreecommitdiff
path: root/scripts/ac_update_extern_pkg
diff options
context:
space:
mode:
authorJames E.H. Turner <jturner@gemini.edu>2016-10-19 16:03:08 -0400
committerJames E.H. Turner <jturner@gemini.edu>2016-10-19 16:03:08 -0400
commitb498bad36b33764d0a7e098c3f47ef3a295030fc (patch)
treef4c8c6026e66480a2b500dc100c7413d6ac96739 /scripts/ac_update_extern_pkg
parent8580f023028de7ecd63439a288effd9c6d5fa6d0 (diff)
downloadastroconda-iraf-helpers-b498bad36b33764d0a7e098c3f47ef3a295030fc.tar.gz
Expand out ternary operators to support Python 2.4...
Diffstat (limited to 'scripts/ac_update_extern_pkg')
-rw-r--r--scripts/ac_update_extern_pkg11
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/ac_update_extern_pkg b/scripts/ac_update_extern_pkg
index b44155d..00d9259 100644
--- a/scripts/ac_update_extern_pkg
+++ b/scripts/ac_update_extern_pkg
@@ -122,7 +122,10 @@ if match:
buffer = buffer[:match.start()]
# Make sure what goes before the "keep" ends with a new line (unless empty):
-sep = '\n' if buffer.strip() else ''
+if buffer.strip():
+ sep = '\n'
+else:
+ sep = ''
buffer = re.compile('\n?\Z', flags=re.M).sub(sep, buffer)
# Find the last entry in extern.pkg (if any) that matches the template:
@@ -155,7 +158,11 @@ if match:
# Replace the entry by 2 separator lines (unless it's the first one):
buf_before = buffer[:match.start()].rstrip()
buf_after = buffer[match.end():].lstrip()
- buffer = buf_before + ('\n\n' if buf_before else '') + buf_after
+ if buf_before:
+ sep = '\n\n'
+ else:
+ sep = ''
+ buffer = buf_before + sep + buf_after
del buf_before, buf_after
match = None