sf-list-dir - added new tool 'listdir.py' which can exclude a directory and changed the behaviour of sf-list-dir to stop scanning epoc32/build to speed things up.
--- a/common/build.xml Wed Aug 12 18:04:33 2009 +0100
+++ b/common/build.xml Wed Aug 12 19:28:52 2009 +0100
@@ -453,14 +453,16 @@
<target name="sf-list-dir">
<property name="sf.currentlist.name" value="${sf.list.name}"/>
<property name="sf.dir.location" value="${build.drive}/epoc32"/>
+ <property name="sf.dir.exclude" value="${build.drive}/epoc32/build"/>
<if>
<istrue value="${sf.spec.dirlist.enable}"/>
<then>
- <echo message="Dirlist name: ${sf.currentlist.name} requested for ${sf.dir.location}"/>
- <exec executable="perl" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist.name}.log">
- <arg value="${sf.common.config.dir}/tools/listdir.pl"/>
+ <echo message="Dirlist name: ${sf.currentlist.name} requested for ${sf.dir.location} excluding ${sf.dir.exclude}"/>
+ <exec executable="python" dir="${build.log.dir}/" failonerror="true" output="${build.log.dir}/listdir_${build.id}_${sf.currentlist.name}.log">
+ <arg value="${sf.common.config.dir}/tools/listdir.py"/>
<arg value="${sf.dir.location}"/>
+ <arg value="${sf.dir.exclude}"/>
</exec>
</then>
</if>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/listdir.py Wed Aug 12 19:28:52 2009 +0100
@@ -0,0 +1,43 @@
+# Copyright (c) 2009 Symbian Foundation Ltd
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Symbian Foundation Ltd - initial contribution.
+#
+# Contributors:
+# mattd <mattd@symbian.org>
+#
+# Description:
+# listdir.py - Lists a directory contents.
+# listdir.py <directory> (<exclude_directory>)
+
+import os
+import re
+import sys
+import string
+from os.path import join, isfile
+
+def main():
+ directory = sys.argv[1]
+ exclude_dirs = []
+ if(len(sys.argv)>2):
+ x_dirs = string.lower(sys.argv[2])
+ exclude_dirs = re.split(',', x_dirs)
+ scandir(directory, exclude_dirs)
+
+def scandir(top, exclude_dirs):
+ fixpath = re.compile('\\\\')
+ fixroot = re.compile('^%s\\\\' % top)
+ for root, dirs, files in os.walk(top, topdown=True):
+ for dirname in dirs:
+ if(string.lower(fixpath.sub('/',os.path.join(root,dirname))) in exclude_dirs):
+ dirs.remove(dirname)
+ for name in files:
+ filename = os.path.join(root, name)
+ fn = string.lower(fixpath.sub('/',fixroot.sub('',filename)))
+ print fn
+
+main()