install.py

branch
5_1_x
changeset 1116
ba7dd484ce98
parent 904
0e938fc74f84
child 1185
d47de1d09f7c
--- a/install.py	Sun Jun 05 18:27:56 2011 +0200
+++ b/install.py	Tue Jun 07 08:40:34 2011 +0200
@@ -202,7 +202,7 @@
     return wname
 
 
-def copyTree(src, dst, filters, excludeDirs=[]):
+def copyTree(src, dst, filters, excludeDirs=[], excludePatterns=[]):
     """
     Copy Python, translation, documentation, wizards configuration,
     designer template files and DTDs of a directory tree.
@@ -211,6 +211,7 @@
     @param dst name of the destination directory
     @param filters list of filter pattern determining the files to be copied
     @param excludeDirs list of (sub)directories to exclude from copying
+    @keyparam excludePatterns list of filter pattern determining the files to be skipped
     """
     try:
         names = os.listdir(src)
@@ -218,17 +219,23 @@
         return      # ignore missing directories (most probably the i18n directory)
     
     for name in names:
-        srcname = os.path.join(src, name)
-        dstname = os.path.join(dst, name)
-        for filter in filters:
-            if fnmatch.fnmatch(srcname, filter):
-                if not os.path.isdir(dst):
-                    os.makedirs(dst)
-                shutil.copy2(srcname, dstname)
+        skipIt = False
+        for excludePattern in excludePatterns:
+            if fnmatch.fnmatch(name, excludePattern):
+                skipIt = True
                 break
-        else:
-            if os.path.isdir(srcname) and not srcname in excludeDirs:
-                copyTree(srcname, dstname, filters)
+        if not skipIt:
+            srcname = os.path.join(src, name)
+            dstname = os.path.join(dst, name)
+            for filter in filters:
+                if fnmatch.fnmatch(srcname, filter):
+                    if not os.path.isdir(dst):
+                        os.makedirs(dst)
+                    shutil.copy2(srcname, dstname)
+                    break
+            else:
+                if os.path.isdir(srcname) and not srcname in excludeDirs:
+                    copyTree(srcname, dstname, filters, excludePatterns=excludePatterns)
 
 
 def createGlobalPluginsDir():
@@ -382,8 +389,9 @@
                 shutil.copy(configName + 'c', modDir)
         
         # copy the various parts of eric5
-        copyTree(sourceDir, cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'], 
-            ['{1}{0}Examples'.format(os.sep, sourceDir)])
+        copyTree(sourceDir, cfg['ericDir'], ['*.py', '*.pyc', '*.pyo', '*.pyw'],
+            ['{1}{0}Examples'.format(os.sep, sourceDir)], 
+            excludePatterns=["eric5config.py*"])
         copyTree(sourceDir, cfg['ericDir'], ['*.rb'], 
             ['{1}{0}Examples'.format(os.sep, sourceDir)])
         copyTree('{1}{0}Plugins'.format(os.sep, sourceDir), 

eric ide

mercurial