Commits

Steve Losh committed a34c60c

Add the ability to ignore certain filenames (useful for content in a VCS).

  • Participants
  • Parent commits ccd79c8

Comments (0)

Files changed (1)

blatter/__init__.py

 
 def find_dynamic_uris(config):
     uris, root = [], config.dynamic_path
+    
+    ignore = []
+    if os.path.exists('ignore'):
+        ignore = [line.strip() for line in open('ignore')]
+    
     def walker(_, path, files):
+        for i in ignore:
+            files.remove(i) if i in files else None
         local = path[len(root):].lstrip('/')
         uris.extend(os.path.join(config.url_prefix, local, f)
                     for f in files if os.path.isfile(os.path.join(path, f)))
     """Copy static files into the output folder using rsync."""
     config = load_config()
     source = "%s/" % config.static_path.rstrip('/')
-
+    
+    ignore = "--exclude-from=ignore" if os.path.exists('ignore') else ''
     target = "%s/" % os.path.join(config.output_path,
                                   config.url_prefix.lstrip('/'))
     if not os.path.exists(target):
         os.makedirs(target)
-    args = ['rsync', '-rv', source, target]
+    args = ['rsync', '-rv', ignore, source, target]
     rsync = subprocess.Popen(args, stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE)
     res = rsync.wait()