aboutsummaryrefslogtreecommitdiff
path: root/scripts/translate-handles.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2010-10-04 20:59:17 +0000
committerRob Austein <sra@hactrn.net>2010-10-04 20:59:17 +0000
commitf1c112eff031759d94f283cd08a311be68e715a0 (patch)
treeeb93aebb01a2fbae4a0a69e5dba2ddb3559fbc0e /scripts/translate-handles.py
parentf347d7a1347c542d9a4e9ea9b3f100674f0d094a (diff)
Hack rpki.myrpki.csv_writer to write to a temporary filename, then
rename to the real filename on close. svn path=/rpkid.without_tls/rpki/myrpki.py; revision=3457
Diffstat (limited to 'scripts/translate-handles.py')
-rw-r--r--scripts/translate-handles.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/scripts/translate-handles.py b/scripts/translate-handles.py
index 42be9eb8..68695e38 100644
--- a/scripts/translate-handles.py
+++ b/scripts/translate-handles.py
@@ -37,13 +37,11 @@ translations = dict((src, dst) for src, dst in rpki.myrpki.csv_reader("translati
for filename in sys.argv[1:]:
- tmpfile = "%s.%d.tmp" % (filename, os.getpid())
- csvout = rpki.myrpki.csv_writer(tmpfile)
+ f = rpki.myrpki.csv_writer(filename)
for cols in rpki.myrpki.csv_reader(filename):
if cols[0] in translations:
cols[0] = translations[cols[0]]
- csvout.writerow(cols)
+ f.writerow(cols)
- del csvout
- os.rename(tmpfile, filename)
+ f.close()