Fix cleanup tools
Adjust for manual move Do not assume that tmpfile and target are on the same filesystem and use copy instead of rename. Change-Id: Ide16e541032f5bcc3ea462a9347faebdc5d7d670
This commit is contained in:
parent
fe34b9bcb6
commit
ff2aba90a4
|
@ -7,7 +7,7 @@
|
||||||
# Call ./tools/cleanup/remove_trailing_whitespaces.sh in the
|
# Call ./tools/cleanup/remove_trailing_whitespaces.sh in the
|
||||||
# root of openstack-manuals.
|
# root of openstack-manuals.
|
||||||
|
|
||||||
files=$(find doc/src/docbkx -name *.xml -not -name pom.xml)
|
files=$(find doc -name *.xml -not -name pom.xml)
|
||||||
for file in $files; do
|
for file in $files; do
|
||||||
sed -i -e 's/[[:space:]]*$//' $file
|
sed -i -e 's/[[:space:]]*$//' $file
|
||||||
done
|
done
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import shutil
|
||||||
|
|
||||||
# should be the same like in tools/validate.py
|
# should be the same like in tools/validate.py
|
||||||
FILE_EXCEPTIONS = ['ha-guide-docinfo.xml','bk001-ch003-associate-general.xml']
|
FILE_EXCEPTIONS = ['ha-guide-docinfo.xml','bk001-ch003-associate-general.xml']
|
||||||
|
@ -33,7 +34,7 @@ for element in elements:
|
||||||
checks.append(re.compile("(.*<%s>)\s+([\w\-().:!?{}\[\]]+.*\n)" % element)),
|
checks.append(re.compile("(.*<%s>)\s+([\w\-().:!?{}\[\]]+.*\n)" % element)),
|
||||||
checks.append(re.compile("(.*[\w\-().:!?{}\[\]]+)\s+(<\/%s>.*\n)" % element))
|
checks.append(re.compile("(.*[\w\-().:!?{}\[\]]+)\s+(<\/%s>.*\n)" % element))
|
||||||
|
|
||||||
for root, dirs, files in os.walk('doc/src/docbkx/'):
|
for root, dirs, files in os.walk('doc/'):
|
||||||
for f in files:
|
for f in files:
|
||||||
if (not (f.endswith('.xml') and
|
if (not (f.endswith('.xml') and
|
||||||
f != 'pom.xml' and
|
f != 'pom.xml' and
|
||||||
|
@ -51,6 +52,5 @@ for root, dirs, files in os.walk('doc/src/docbkx/'):
|
||||||
tmpfd.write(line)
|
tmpfd.write(line)
|
||||||
tmpfd.close()
|
tmpfd.close()
|
||||||
if match:
|
if match:
|
||||||
os.rename(tmpfile[1], docfile)
|
shutil.copyfile(tmpfile[1], docfile)
|
||||||
else:
|
os.unlink(tmpfile[1])
|
||||||
os.unlink(tmpfile[1])
|
|
||||||
|
|
Loading…
Reference in New Issue