/usr/share/clam/sconstools/changeExampleDataPath.py is in libclam-dev 1.4.0-5.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #! /usr/bin/python
import os.path, glob, re, sys
def scanFiles(pattern, paths) :
files = []
for path in paths :
files+=glob.glob(os.path.join(path,pattern))
return files
install_path = '/usr/share/smstools'
source_path = install_path
if len(sys.argv) not in [2,3]:
print 'usage:'
print sys.argv[0], 'source_path [install_path]'
print 'where install_path will be pre-appended to example-data'
if len(sys.argv)>1:
source_path = sys.argv[1]
if len(sys.argv)>2:
install_path = sys.argv[2]
print
print 'example-data will be taken from:', source_path
print 'and installed into:', install_path
print
xmls = scanFiles( '*.xml', [ source_path+'/example-data' ] )
print 'files to process: ', '\n'.join(xmls)
for file in xmls:
f = open(file)
content = f.read()
f.close()
content = re.sub(r'>example-data/', r'>%s/example-data/' % install_path, content)
f = open(file, 'w')
f.write( content )
f.close()
print file, 'has been changed.'
print 'done!'
|