fixed static file collection for third party components: now relying on symlinks
authorJordan Augé <jordan.auge@lip6.fr>
Thu, 19 Sep 2013 12:40:33 +0000 (14:40 +0200)
committerJordan Augé <jordan.auge@lip6.fr>
Thu, 19 Sep 2013 12:40:33 +0000 (14:40 +0200)
53 files changed:
third-party/codemirror [new symlink]
third-party/datatables [new symlink]
third-party/datatables-1.9.4/css/README [moved from third-party/datatables/css/README with 100% similarity]
third-party/datatables-1.9.4/css/dataTables.bootstrap.css [moved from third-party/datatables/css/dataTables.bootstrap.css with 100% similarity]
third-party/datatables-1.9.4/css/dataTables.bootstrap.css.url [moved from third-party/datatables/css/dataTables.bootstrap.css.url with 100% similarity]
third-party/datatables-1.9.4/img/sort_asc.png [moved from third-party/datatables/img/sort_asc.png with 100% similarity]
third-party/datatables-1.9.4/img/sort_asc_disabled.png [moved from third-party/datatables/img/sort_asc_disabled.png with 100% similarity]
third-party/datatables-1.9.4/img/sort_both.png [moved from third-party/datatables/img/sort_both.png with 100% similarity]
third-party/datatables-1.9.4/img/sort_desc.png [moved from third-party/datatables/img/sort_desc.png with 100% similarity]
third-party/datatables-1.9.4/img/sort_desc_disabled.png [moved from third-party/datatables/img/sort_desc_disabled.png with 100% similarity]
third-party/datatables-1.9.4/img/sort_none.png [moved from third-party/datatables/img/sort_none.png with 100% similarity]
third-party/datatables-1.9.4/js/dataTables-1.9.3.js [moved from third-party/datatables/js/dataTables-1.9.3.js with 100% similarity]
third-party/datatables-1.9.4/js/dataTables-1.9.4.js [moved from third-party/datatables/js/dataTables-1.9.4.js with 100% similarity]
third-party/datatables-1.9.4/js/dataTables-1.9.4.url [moved from third-party/datatables/js/dataTables-1.9.4.url with 100% similarity]
third-party/datatables-1.9.4/js/dataTables.bootstrap.js [moved from third-party/datatables/js/dataTables.bootstrap.js with 100% similarity]
third-party/datatables-1.9.4/js/dataTables.bootstrap.js.url [moved from third-party/datatables/js/dataTables.bootstrap.js.url with 100% similarity]
third-party/datatables-1.9.4/js/dataTables.js [moved from third-party/datatables/js/dataTables.js with 100% similarity]
third-party/jquery [new symlink]
third-party/jquery-2.0.3/js/jquery-1.10.2.js [moved from third-party/jquery/js/jquery-1.10.2.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.10.2.js.url [moved from third-party/jquery/js/jquery-1.10.2.js.url with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.10.2.min.js [moved from third-party/jquery/js/jquery-1.10.2.min.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.10.2.min.js.url [moved from third-party/jquery/js/jquery-1.10.2.min.js.url with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.7.2.js [moved from third-party/jquery/js/jquery-1.7.2.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.7.2.js.url [moved from third-party/jquery/js/jquery-1.7.2.js.url with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.7.2.min.js [moved from third-party/jquery/js/jquery-1.7.2.min.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.7.2.min.js.url [moved from third-party/jquery/js/jquery-1.7.2.min.js.url with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.9.1.js [moved from third-party/jquery/js/jquery-1.9.1.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.9.1.min.js [moved from third-party/jquery/js/jquery-1.9.1.min.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery-1.9.1.min.js.url [moved from third-party/jquery/js/jquery-1.9.1.min.js.url with 100% similarity]
third-party/jquery-2.0.3/js/jquery-2.0.3.js [moved from third-party/jquery/js/jquery-2.0.3.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery-2.0.3.js.url [moved from third-party/jquery/js/jquery-2.0.3.js.url with 100% similarity]
third-party/jquery-2.0.3/js/jquery-2.0.3.min.js [moved from third-party/jquery/js/jquery-2.0.3.min.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery-2.0.3.min.js.url [moved from third-party/jquery/js/jquery-2.0.3.min.js.url with 100% similarity]
third-party/jquery-2.0.3/js/jquery.js [moved from third-party/jquery/js/jquery.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery.min.js [moved from third-party/jquery/js/jquery.min.js with 100% similarity]
third-party/jquery-2.0.3/js/jquery.validate.js [moved from third-party/jquery/js/jquery.validate.js with 100% similarity]
third-party/jquery-html5storage [new symlink]
third-party/jquery-html5storage-1.0/jquery.html5storage.js [moved from third-party/jquery-html5storage/jquery.html5storage.js with 100% similarity]
third-party/jquery-html5storage-1.0/jquery.html5storage.min.js [moved from third-party/jquery-html5storage/jquery.html5storage.min.js with 100% similarity]
third-party/jquery-html5storage-1.0/jquery.html5storage.url [moved from third-party/jquery-html5storage/jquery.html5storage.url with 100% similarity]
third-party/jquery-notify [new symlink]
third-party/jquery-notify-1.5/alert.png [moved from third-party/jquery-notify/alert.png with 100% similarity]
third-party/jquery-notify-1.5/jquery.notify.js [moved from third-party/jquery-notify/jquery.notify.js with 100% similarity]
third-party/jquery-notify-1.5/jquery.notify.min.js [moved from third-party/jquery-notify/jquery.notify.min.js with 100% similarity]
third-party/jquery-notify-1.5/style.css [moved from third-party/jquery-notify/style.css with 100% similarity]
third-party/jquery-notify-1.5/ui.notify.css [moved from third-party/jquery-notify/ui.notify.css with 100% similarity]
third-party/mustache [new symlink]
third-party/mustache-7035bf3e5f/mustache.js [moved from third-party/mustache/mustache.js with 100% similarity]
third-party/smartwizard [new symlink]
third-party/uuid [new symlink]
third-party/uuid-1.4/Math.uuid.js [moved from third-party/uuid/Math.uuid.js with 100% similarity]
third-party/uuid-1.4/Math.uuid.js.url [moved from third-party/uuid/Math.uuid.js.url with 100% similarity]
unfold/static.py

diff --git a/third-party/codemirror b/third-party/codemirror
new file mode 120000 (symlink)
index 0000000..bd8c3e7
--- /dev/null
@@ -0,0 +1 @@
+codemirror-3.15
\ No newline at end of file
diff --git a/third-party/datatables b/third-party/datatables
new file mode 120000 (symlink)
index 0000000..e657a7e
--- /dev/null
@@ -0,0 +1 @@
+datatables-1.9.4/
\ No newline at end of file
diff --git a/third-party/jquery b/third-party/jquery
new file mode 120000 (symlink)
index 0000000..e71f93a
--- /dev/null
@@ -0,0 +1 @@
+jquery-2.0.3/
\ No newline at end of file
diff --git a/third-party/jquery-html5storage b/third-party/jquery-html5storage
new file mode 120000 (symlink)
index 0000000..aa2a90f
--- /dev/null
@@ -0,0 +1 @@
+jquery-html5storage-1.0
\ No newline at end of file
diff --git a/third-party/jquery-notify b/third-party/jquery-notify
new file mode 120000 (symlink)
index 0000000..cf980dd
--- /dev/null
@@ -0,0 +1 @@
+jquery-notify-1.5
\ No newline at end of file
diff --git a/third-party/mustache b/third-party/mustache
new file mode 120000 (symlink)
index 0000000..a73c9dd
--- /dev/null
@@ -0,0 +1 @@
+mustache-7035bf3e5f
\ No newline at end of file
diff --git a/third-party/smartwizard b/third-party/smartwizard
new file mode 120000 (symlink)
index 0000000..3745e8f
--- /dev/null
@@ -0,0 +1 @@
+smartwizard-1636c86
\ No newline at end of file
diff --git a/third-party/uuid b/third-party/uuid
new file mode 120000 (symlink)
index 0000000..d7a8d5f
--- /dev/null
@@ -0,0 +1 @@
+uuid-1.4/
\ No newline at end of file
index 815e8e2..ad38a9e 100644 (file)
@@ -4,6 +4,16 @@ from django.utils.datastructures import SortedDict
 from django.contrib.staticfiles.finders import BaseFinder, FileSystemFinder
 from django.core.files.storage import FileSystemStorage
 
+# DEPRECATED # # http://nicks-liquid-soapbox.blogspot.fr/2011/03/splitting-path-to-list-in-python.html
+# DEPRECATED # def splitpath(path, maxdepth=20):
+# DEPRECATED #      ( head, tail ) = os.path.split(path)
+# DEPRECATED #      return splitpath(head, maxdepth - 1) + [ tail ] \
+# DEPRECATED #          if maxdepth and head and head != path \
+# DEPRECATED #          else [ head or tail ]
+
+# The plugin finder is responsible for collecting JS, CSS and PNG files from
+# the plugins, which are not declared in the myslice.settings file unlike
+# applications.
 class PluginFinder(FileSystemFinder):
     """
     A static files finder that looks in the directory of each plugin as
@@ -75,27 +85,57 @@ class ThirdPartyFinder(BaseFinder):
         a two item iterable consisting of the relative path and storage
         instance.
         """
-        for (path, dirs, files) in os.walk(settings.THIRDPARTY_DIR):
-            for file in files:
-                name, extension = os.path.splitext(file)
 
-                for type, extensions in self.extensions.items():
-                    if not extension in extensions:
-                        continue
-                    filesystem_storage = FileSystemStorage(location=path)
-                    filesystem_storage.prefix = type
-                    yield file, filesystem_storage
+        for component in os.listdir(settings.THIRDPARTY_DIR):
+            # We are looking forward symlinks only
+            component_path = os.path.join(settings.THIRDPARTY_DIR, component)
+            if not os.path.islink(component_path) or not os.path.isdir(component_path):
+                continue
+                
+            for (path, dirs, files) in os.walk(component_path):
+                for file in files:
+                    name, extension = os.path.splitext(file)
 
-class BaseFinder(object):
-    """
-    A base file finder to be used for custom staticfiles finder classes.
-    """
+                    for type, extensions in self.extensions.items():
+                        if not extension in extensions:
+                            continue
+                        filesystem_storage = FileSystemStorage(location=path)
+                        filesystem_storage.prefix = type
+                        yield file, filesystem_storage
+            
+# DEPRECATED #         for (path, dirs, files) in os.walk(settings.THIRDPARTY_DIR):
+# DEPRECATED #             component_path = path[len(settings.THIRDPARTY_DIR)+1:]
+# DEPRECATED #             component_name = splitpath(component_path)[0]
+# DEPRECATED #             print "PATH", path, " -- COMPONENT", component_name
+# DEPRECATED #             if not os.path.islink(os.path.join(path, component_name)):
+# DEPRECATED #                 print "IGNORED", component_name
+# DEPRECATED #                 continue
+# DEPRECATED #             print "COMPONENT ADDED: ", component_name
+# DEPRECATED #             print "=="
+# DEPRECATED # 
+# DEPRECATED # 
+# DEPRECATED #             for file in files:
+# DEPRECATED #                 name, extension = os.path.splitext(file)
+# DEPRECATED # 
+# DEPRECATED #                 for type, extensions in self.extensions.items():
+# DEPRECATED #                     if not extension in extensions:
+# DEPRECATED #                         continue
+# DEPRECATED #                     filesystem_storage = FileSystemStorage(location=path)
+# DEPRECATED #                     filesystem_storage.prefix = type
+# DEPRECATED #                     yield file, filesystem_storage
 
-    def list(self, ignore_patterns):
-        """
-        Given an optional list of paths to ignore, this should return
-        a two item iterable consisting of the relative path and storage
-        instance.
-        """
-        raise NotImplementedError()
+# XXX I commented this since it should be imported from django.contrib.staticfiles.finders -- jordan
+#class BaseFinder(object):
+#    """
+#    A base file finder to be used for custom staticfiles finder classes.
+#    """
+#
+#    def list(self, ignore_patterns):
+#        """
+#        Given an optional list of paths to ignore, this should return
+#        a two item iterable consisting of the relative path and storage
+#        instance.
+#        """
+#        raise NotImplementedError()