[Python-modules-commits] [django-pipeline] 01/06: New upstream version 1.6.13

Brian May bam at moszumanska.debian.org
Sun Jul 2 10:32:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

bam pushed a commit to branch debian/master
in repository django-pipeline.

commit 327791f2275f1de0d345978c4ca465f448a433d7
Author: Brian May <bam at debian.org>
Date:   Sun Jul 2 19:44:26 2017 +1000

    New upstream version 1.6.13
---
 AUTHORS                               |   8 +
 CONTRIBUTING.rst                      |  19 +++
 HISTORY.rst                           |  35 +++++
 MANIFEST.in                           |   3 +-
 PKG-INFO                              |  71 ++++++++-
 README.rst                            |  16 +-
 django_pipeline.egg-info/PKG-INFO     |  71 ++++++++-
 django_pipeline.egg-info/SOURCES.txt  |   6 +-
 django_pipeline.egg-info/requires.txt |   1 +
 docs/compressors.rst                  |   2 +-
 docs/conf.py                          |   2 +-
 docs/configuration.rst                |  16 +-
 docs/usage.rst                        |  47 +++++-
 pipeline/collector.py                 |  10 +-
 pipeline/compilers/__init__.py        |  11 +-
 pipeline/compressors/__init__.py      |   4 +-
 pipeline/conf.py                      |   3 +-
 pipeline/finders.py                   |   3 +-
 pipeline/forms.py                     | 273 ++++++++++++++++++++++++++++++++++
 pipeline/middleware.py                |  11 +-
 pipeline/packager.py                  |  18 ++-
 pipeline/templatetags/pipeline.py     |   4 +-
 setup.cfg                             |   2 +-
 setup.py                              |  21 ++-
 tests/assets/css/urls.css             |   3 +
 tests/package.json                    |  27 ----
 tests/scripts/npm_install.py          |  42 ------
 tests/settings.py                     |  17 ++-
 tests/tests/test_collector.py         |  23 +++
 tests/tests/test_compiler.py          |  27 +++-
 tests/tests/test_compressor.py        |   5 +-
 tests/tests/test_forms.py             | 200 +++++++++++++++++++++++++
 tests/tests/test_storage.py           |   3 +
 tests/urls.py                         |   9 +-
 tests/utils.py                        |   6 +
 35 files changed, 890 insertions(+), 129 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 62f4982..e87d444 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -18,11 +18,13 @@ or just made Pipeline more awesome.
  * Andy Kish <agkish at gmail.com>
  * Ara Anjargolian <ara818 at gmail.com>
  * Arnar Yngvason <arnar at hvitahusid.is>
+ * Austin Pua <pua.austin.anderson at gmail.com>
  * Axel Haustant <noirbizarre at gmail.com>
  * Balazs Kossovics <balazs.kossovics at e-loue.com>
  * Ben Vinegar <ben at benv.ca>
  * Brad Pitcher <bradpitcher at gmail.com>
  * Brant Young <brant.young at gmail.com>
+ * Brawaga <brawaga at gmail.com>
  * Brian Montgomery <brianm at appliedsec.com>
  * Bryan Chow <bryan at fullfactor.com>
  * Caio Ariede <caio.ariede at gmail.com>
@@ -59,6 +61,8 @@ or just made Pipeline more awesome.
  * Jannis Leidel <jannis at leidel.info>
  * Jared Scott <jscott at convertro.com>
  * Jaromir Fojtu <jaromir.fojtu at gmail.com>
+ * Jeff Held <jheld135 at gmail.com>
+ * John Whitlock <John-Whitlock at ieee.org> (@jwhitlock)
  * Jon Dufresne <jon.dufresne at gmail.com>
  * Josh Braegger <rckclmbr at gmail.com>
  * Joshua Kehn <josh at kehn.us>
@@ -91,6 +95,7 @@ or just made Pipeline more awesome.
  * Sam Thomson <sammthomson at gmail.com>
  * Sander Smits <jhmsmits at gmail.com>
  * Sander Steffann <sander at steffann.nl>
+ * Sassan Haradji (@sassanh)
  * Sayed Raianul Kabir <raian at newscred.com>
  * Simon Lydell <simon.lydell at gmail.com>
  * Sirex <sirexas at gmail.com>
@@ -101,12 +106,15 @@ or just made Pipeline more awesome.
  * Tadas Dailyda <tadas at dailyda.com>
  * Teo Klestrup Röijezon <teo at nullable.se>
  * Thomas Parslow <tom at almostobsolete.net>
+ * Tiago Espinha <tiago at espinha.nl>
  * Timothée Peignier <timothee.peignier at tryphon.org>
  * Tom Yam <tomyam1 at gmail.com>
  * Tomek Paczkowski <tomek at hauru.eu>
  * Trey Smith <trey.smith at nasa.gov>
+ * Vadym S. Khondar (@vskh)
  * Venelin Stoykov <venelin at magicsolutions.bg>
  * Victor Shnayder <victor at mitx.mit.edu>
  * Wictor Olseryd <wictor at olseryd.se>
+ * Wismill
  * Zachary Kazanski <kazanski.zachary at gmail.com>
  * Zenobius Jiricek <zenobius.jiricek at gmail.com>
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
new file mode 100644
index 0000000..29640d0
--- /dev/null
+++ b/CONTRIBUTING.rst
@@ -0,0 +1,19 @@
+.. image:: https://jazzband.co/static/img/jazzband.svg
+   :target: https://jazzband.co/
+   :alt: Jazzband
+
+This is a `Jazzband <https://jazzband.co>`_ project. By contributing you agree to abide by the `Contributor Code of Conduct <https://jazzband.co/docs/conduct>`_ and follow the `guidelines <https://jazzband.co/docs/guidelines>`_.
+
+Contribute
+==========
+
+#. Check for open issues or open a fresh issue to start a discussion around a
+   feature idea or a bug. There is a **contribute!** tag for issues that should be
+   ideal for people who are not very familiar with the codebase yet.
+#. Fork the repository on Github to start making your changes on a topic branch.
+#. Write a test which shows that the bug was fixed or that the feature works as expected.
+#. Send a pull request and bug the maintainer until it gets merged and published.
+   Make sure to add yourself to *AUTHORS*.
+
+Otherwise, if you simply wants to suggest a feature or report a bug, create an issue :
+https://github.com/jazzband/django-pipeline/issues
diff --git a/HISTORY.rst b/HISTORY.rst
index 0fe40ed..874bb07 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,6 +3,41 @@
 History
 =======
 
+1.6.13
+======
+
+* Fix forward-slashed paths on Windows. Thanks to @etiago
+* Fix CSS URL detector to match quotes correctly. Thanks to @vskh
+* Add a compiler_options dict to compile, to allow passing options to custom
+  compilers. Thanks to @sassanh
+* Verify support for Django 1.11. Thanks to @jwhitlock
+
+1.6.12
+======
+
+* Supports Django 1.11
+* Fix a bug with os.rename on windows. Thanks to @wismill
+* Fix to view compile error if happens. Thanks to @brawaga
+* Add support for Pipeline CSS/JS packages in forms and widgets. Thanks to @chipx86
+
+1.6.11
+======
+
+* Fix performance regression. Thanks to Christian Hammond.
+
+1.6.10
+======
+
+* Added Django 1.10 compatiblity issues. Thanks to Austin Pua and Silvan Spross.
+* Documentation improvements. Thanks to Chris Streeter.
+
+1.6.9
+=====
+
+* Various build improvements.
+* Improved setup.py classifiers. Thanks to Sobolev Nikita.
+* Documentation improvements. Thanks to Adam Chainz.
+
 1.6.8
 =====
 
diff --git a/MANIFEST.in b/MANIFEST.in
index c91427a..83b1691 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,6 @@
 recursive-include pipeline/templates *.html *.jinja
 recursive-include pipeline/jinja2 *.html *.jinja
-include AUTHORS LICENSE README.rst HISTORY.rst
+include AUTHORS LICENSE README.rst HISTORY.rst CONTRIBUTING.rst
 recursive-include tests *
 recursive-exclude tests *.pyc *.pyo
 recursive-exclude tests/node_modules *
@@ -8,3 +8,4 @@ recursive-exclude tests/npm-cache *
 recursive-exclude tests/npm *
 include docs/Makefile docs/make.bat docs/conf.py
 recursive-include docs *.rst
+exclude package.json requirements.txt tox.ini
diff --git a/PKG-INFO b/PKG-INFO
index 50eb357..c642479 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-pipeline
-Version: 1.6.8
+Version: 1.6.13
 Summary: Pipeline is an asset packaging library for Django.
 Home-page: https://github.com/jazzband/django-pipeline
 Author: Timothée Peignier
@@ -9,13 +9,21 @@ License: MIT
 Description: Pipeline
         ========
         
-        .. image:: https://secure.travis-ci.org/jazzband/django-pipeline.png
+        .. image:: https://travis-ci.org/jazzband/django-pipeline.svg?branch=master
             :alt: Build Status
             :target: http://travis-ci.org/jazzband/django-pipeline
         
+        .. image:: https://coveralls.io/repos/github/jazzband/django-pipeline/badge.svg?branch=master
+            :alt: Code Coverage
+            :target: https://coveralls.io/github/jazzband/django-pipeline?branch=master
+        
         .. image:: https://jazzband.co/static/img/badge.svg
-           :alt: Jazzband
-           :target: https://jazzband.co/
+            :alt: Jazzband
+            :target: https://jazzband.co/
+        
+        .. image:: https://badge.fury.io/py/django-pipeline.svg
+            :alt: PYPI
+            :target: https://badge.fury.io/py/django-pipeline
         
         Pipeline is an asset packaging library for Django, providing both CSS and
         JavaScript concatenation and compression, built-in JavaScript template support,
@@ -34,7 +42,7 @@ Description: Pipeline
         -------------
         
         For documentation, usage, and examples, see :
-        https://django-pipeline.readthedocs.org
+        https://django-pipeline.readthedocs.io
         
         
         .. :changelog:
@@ -42,6 +50,41 @@ Description: Pipeline
         History
         =======
         
+        1.6.13
+        ======
+        
+        * Fix forward-slashed paths on Windows. Thanks to @etiago
+        * Fix CSS URL detector to match quotes correctly. Thanks to @vskh
+        * Add a compiler_options dict to compile, to allow passing options to custom
+          compilers. Thanks to @sassanh
+        * Verify support for Django 1.11. Thanks to @jwhitlock
+        
+        1.6.12
+        ======
+        
+        * Supports Django 1.11
+        * Fix a bug with os.rename on windows. Thanks to @wismill
+        * Fix to view compile error if happens. Thanks to @brawaga
+        * Add support for Pipeline CSS/JS packages in forms and widgets. Thanks to @chipx86
+        
+        1.6.11
+        ======
+        
+        * Fix performance regression. Thanks to Christian Hammond.
+        
+        1.6.10
+        ======
+        
+        * Added Django 1.10 compatiblity issues. Thanks to Austin Pua and Silvan Spross.
+        * Documentation improvements. Thanks to Chris Streeter.
+        
+        1.6.9
+        =====
+        
+        * Various build improvements.
+        * Improved setup.py classifiers. Thanks to Sobolev Nikita.
+        * Documentation improvements. Thanks to Adam Chainz.
+        
         1.6.8
         =====
         
@@ -116,12 +159,28 @@ Description: Pipeline
         * Drop support for Python 2.6.
         * **BACKWARD INCOMPATIBLE** : Change configuration settings.
         
+Keywords: django pipeline asset compiling concatenation compression packaging
 Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Web Environment
+Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.6
+Classifier: Framework :: Django :: 1.7
+Classifier: Framework :: Django :: 1.8
+Classifier: Framework :: Django :: 1.9
+Classifier: Framework :: Django :: 1.10
+Classifier: Framework :: Django :: 1.11
 Classifier: Intended Audience :: Developers
-Classifier: Development Status :: 5 - Production/Stable
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Utilities
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Internet :: WWW/HTTP
+Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
diff --git a/README.rst b/README.rst
index 6274a3d..4fd8d7e 100644
--- a/README.rst
+++ b/README.rst
@@ -1,13 +1,21 @@
 Pipeline
 ========
 
-.. image:: https://secure.travis-ci.org/jazzband/django-pipeline.png
+.. image:: https://travis-ci.org/jazzband/django-pipeline.svg?branch=master
     :alt: Build Status
     :target: http://travis-ci.org/jazzband/django-pipeline
 
+.. image:: https://coveralls.io/repos/github/jazzband/django-pipeline/badge.svg?branch=master
+    :alt: Code Coverage
+    :target: https://coveralls.io/github/jazzband/django-pipeline?branch=master
+
 .. image:: https://jazzband.co/static/img/badge.svg
-   :alt: Jazzband
-   :target: https://jazzband.co/
+    :alt: Jazzband
+    :target: https://jazzband.co/
+
+.. image:: https://badge.fury.io/py/django-pipeline.svg
+    :alt: PYPI
+    :target: https://badge.fury.io/py/django-pipeline
 
 Pipeline is an asset packaging library for Django, providing both CSS and
 JavaScript concatenation and compression, built-in JavaScript template support,
@@ -26,4 +34,4 @@ Documentation
 -------------
 
 For documentation, usage, and examples, see :
-https://django-pipeline.readthedocs.org
+https://django-pipeline.readthedocs.io
diff --git a/django_pipeline.egg-info/PKG-INFO b/django_pipeline.egg-info/PKG-INFO
index 50eb357..c642479 100644
--- a/django_pipeline.egg-info/PKG-INFO
+++ b/django_pipeline.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: django-pipeline
-Version: 1.6.8
+Version: 1.6.13
 Summary: Pipeline is an asset packaging library for Django.
 Home-page: https://github.com/jazzband/django-pipeline
 Author: Timothée Peignier
@@ -9,13 +9,21 @@ License: MIT
 Description: Pipeline
         ========
         
-        .. image:: https://secure.travis-ci.org/jazzband/django-pipeline.png
+        .. image:: https://travis-ci.org/jazzband/django-pipeline.svg?branch=master
             :alt: Build Status
             :target: http://travis-ci.org/jazzband/django-pipeline
         
+        .. image:: https://coveralls.io/repos/github/jazzband/django-pipeline/badge.svg?branch=master
+            :alt: Code Coverage
+            :target: https://coveralls.io/github/jazzband/django-pipeline?branch=master
+        
         .. image:: https://jazzband.co/static/img/badge.svg
-           :alt: Jazzband
-           :target: https://jazzband.co/
+            :alt: Jazzband
+            :target: https://jazzband.co/
+        
+        .. image:: https://badge.fury.io/py/django-pipeline.svg
+            :alt: PYPI
+            :target: https://badge.fury.io/py/django-pipeline
         
         Pipeline is an asset packaging library for Django, providing both CSS and
         JavaScript concatenation and compression, built-in JavaScript template support,
@@ -34,7 +42,7 @@ Description: Pipeline
         -------------
         
         For documentation, usage, and examples, see :
-        https://django-pipeline.readthedocs.org
+        https://django-pipeline.readthedocs.io
         
         
         .. :changelog:
@@ -42,6 +50,41 @@ Description: Pipeline
         History
         =======
         
+        1.6.13
+        ======
+        
+        * Fix forward-slashed paths on Windows. Thanks to @etiago
+        * Fix CSS URL detector to match quotes correctly. Thanks to @vskh
+        * Add a compiler_options dict to compile, to allow passing options to custom
+          compilers. Thanks to @sassanh
+        * Verify support for Django 1.11. Thanks to @jwhitlock
+        
+        1.6.12
+        ======
+        
+        * Supports Django 1.11
+        * Fix a bug with os.rename on windows. Thanks to @wismill
+        * Fix to view compile error if happens. Thanks to @brawaga
+        * Add support for Pipeline CSS/JS packages in forms and widgets. Thanks to @chipx86
+        
+        1.6.11
+        ======
+        
+        * Fix performance regression. Thanks to Christian Hammond.
+        
+        1.6.10
+        ======
+        
+        * Added Django 1.10 compatiblity issues. Thanks to Austin Pua and Silvan Spross.
+        * Documentation improvements. Thanks to Chris Streeter.
+        
+        1.6.9
+        =====
+        
+        * Various build improvements.
+        * Improved setup.py classifiers. Thanks to Sobolev Nikita.
+        * Documentation improvements. Thanks to Adam Chainz.
+        
         1.6.8
         =====
         
@@ -116,12 +159,28 @@ Description: Pipeline
         * Drop support for Python 2.6.
         * **BACKWARD INCOMPATIBLE** : Change configuration settings.
         
+Keywords: django pipeline asset compiling concatenation compression packaging
 Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
 Classifier: Environment :: Web Environment
+Classifier: Framework :: Django
+Classifier: Framework :: Django :: 1.6
+Classifier: Framework :: Django :: 1.7
+Classifier: Framework :: Django :: 1.8
+Classifier: Framework :: Django :: 1.9
+Classifier: Framework :: Django :: 1.10
+Classifier: Framework :: Django :: 1.11
 Classifier: Intended Audience :: Developers
-Classifier: Development Status :: 5 - Production/Stable
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Utilities
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Internet :: WWW/HTTP
+Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
diff --git a/django_pipeline.egg-info/SOURCES.txt b/django_pipeline.egg-info/SOURCES.txt
index 9b4ee17..eb386b8 100644
--- a/django_pipeline.egg-info/SOURCES.txt
+++ b/django_pipeline.egg-info/SOURCES.txt
@@ -1,4 +1,5 @@
 AUTHORS
+CONTRIBUTING.rst
 HISTORY.rst
 LICENSE
 MANIFEST.in
@@ -9,6 +10,7 @@ django_pipeline.egg-info/PKG-INFO
 django_pipeline.egg-info/SOURCES.txt
 django_pipeline.egg-info/dependency_links.txt
 django_pipeline.egg-info/not-zip-safe
+django_pipeline.egg-info/requires.txt
 django_pipeline.egg-info/top_level.txt
 docs/Makefile
 docs/compilers.rst
@@ -28,6 +30,7 @@ pipeline/collector.py
 pipeline/conf.py
 pipeline/exceptions.py
 pipeline/finders.py
+pipeline/forms.py
 pipeline/glob.py
 pipeline/manifest.py
 pipeline/middleware.py
@@ -67,7 +70,6 @@ pipeline/templatetags/__init__.py
 pipeline/templatetags/pipeline.py
 tests/__init__.py
 tests/models.py
-tests/package.json
 tests/settings.py
 tests/urls.py
 tests/utils.py
@@ -113,7 +115,6 @@ tests/assets/js/second.js
 tests/assets/templates/photo/detail.jst
 tests/assets/templates/photo/list.jst
 tests/assets/templates/video/detail.jst
-tests/scripts/npm_install.py
 tests/templates/empty.html
 tests/templates/index.html
 tests/tests/__init__.py
@@ -122,6 +123,7 @@ tests/tests/test_collector.py
 tests/tests/test_compiler.py
 tests/tests/test_compressor.py
 tests/tests/test_conf.py
+tests/tests/test_forms.py
 tests/tests/test_glob.py
 tests/tests/test_middleware.py
 tests/tests/test_packager.py
diff --git a/django_pipeline.egg-info/requires.txt b/django_pipeline.egg-info/requires.txt
new file mode 100644
index 0000000..f3a90e9
--- /dev/null
+++ b/django_pipeline.egg-info/requires.txt
@@ -0,0 +1 @@
+futures>=2.1.3
diff --git a/docs/compressors.rst b/docs/compressors.rst
index 31481df..6387aa4 100644
--- a/docs/compressors.rst
+++ b/docs/compressors.rst
@@ -161,7 +161,7 @@ Install the jsmin library with your favorite Python package manager ::
 SlimIt compressor
 =================
 
-The slimit compressor uses `SlimIt <http://slimit.readthedocs.org>`_ to
+The slimit compressor uses `SlimIt <https://slimit.readthedocs.io>`_ to
 compress javascripts.
 
 To use it add this to your ``PIPELINE['JS_COMPRESSOR']`` ::
diff --git a/docs/conf.py b/docs/conf.py
index 3d3a4b5..58b73d5 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -51,7 +51,7 @@ copyright = u'2011-2014, Timothée Peignier'
 # The short X.Y version.
 version = '1.6'
 # The full version, including alpha/beta/rc tags.
-release = '1.6.8'
+release = '1.6.13'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/docs/configuration.rst b/docs/configuration.rst
index 65dec21..a2d4ead 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -123,6 +123,15 @@ Indicate if you want this group to appear in your cache manifest.
 
 Defaults to ``True``.
 
+``compiler_options``
+....................
+
+**Optional**
+
+A dictionary passed to compiler's ``compile_file`` method as kwargs. None of default compilers use it currently. It's to be used by custom compilers in case they need some special parameters.
+
+Defaults to ``{}``.
+
 
 Other settings
 --------------
@@ -143,7 +152,7 @@ Defaults to ``True``
 
 .. note::
 
-  this only work when PIPELINE_ENABLED is False.
+  This only applies when ``PIPELINE_ENABLED`` is ``False``.
 
 ``SHOW_ERRORS_INLINE``
 ......................
@@ -298,4 +307,7 @@ All javascript output is wrapped in an anonymous function : ::
 
 This safety wrapper, make it difficult to pollute the global namespace by accident and improve performance.
 
-You can override this behavior by setting ``DISABLE_WRAPPER`` to ``True``.
+You can override this behavior by setting ``DISABLE_WRAPPER`` to ``True``. If you want to use your own wrapper, change
+the ``JS_WRAPPER`` setting. For example: ::
+
+  JS_WRAPPER = "(function(){stuff();%s})();"
diff --git a/docs/usage.rst b/docs/usage.rst
index 4b19211..f453a93 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -40,6 +40,49 @@ with the name “scripts”, you would use the following code to output them all
    {% stylesheet 'stats' %}
    {% javascript 'scripts' %}
 
+
+Form Media
+==========
+
+Django forms and widgets can specify individual CSS or JavaScript files to
+include on a page by defining a ``Form.Media`` class with ``css`` and ``js``
+attributes.
+
+Pipeline builds upon this by allowing packages to be listed in
+``css_packages`` and ``js_packages``. This is equivalent to manually including
+these packages in a page's template using the template tags.
+
+To use these, just have your form or widget's ``Media`` class inherit from
+``pipeline.forms.PipelineFormMedia`` and define ``css_packages`` and
+``js_packages``. You can also continue to reference individual CSS/JavaScript
+files using the original ``css``/``js`` attributes, if needed.
+
+Note that unlike the template tags, you cannot customize the HTML for
+referencing these files. The ``pipeline/css.html`` and ``pipeline/js.html``
+files will not be used. Django takes care of generating the HTML for form and
+widget media.
+
+
+Example
+-------
+
+.. code-block:: python
+
+    from django import forms
+    from pipeline.forms import PipelineFormMedia
+
+
+    class MyForm(forms.Form):
+        ...
+
+        class Media(PipelineFormMedia):
+            css_packages = {
+                'all': ('my-styles',)
+            }
+            js_packages = ('my-scripts',)
+            js = ('https://cdn.example.com/some-script.js',)
+
+
 Collect static
 ==============
 
@@ -47,7 +90,7 @@ Pipeline integrates with staticfiles, you just need to setup ``STATICFILES_STORA
 
     STATICFILES_STORAGE = 'pipeline.storage.PipelineStorage'
 
-Then when you run ``collectstatic`` command, your CSS and your javascripts will be compressed in the same time ::
+Then when you run ``collectstatic`` command, your CSS and your javascripts will be compressed at the same time ::
 
     $ python manage.py collectstatic
 
@@ -78,7 +121,7 @@ Cache manifest
 ==============
 
 Pipeline provide a way to add your javascripts and stylesheets files to a
-cache-manifest via `Manifesto <http://manifesto.readthedocs.org/>`_.
+cache-manifest via `Manifesto <https://manifesto.readthedocs.io/>`_.
 
 To do so, you just need to add manifesto app to your ``INSTALLED_APPS``.
 
diff --git a/pipeline/collector.py b/pipeline/collector.py
index 4d173c5..3950c8e 100644
--- a/pipeline/collector.py
+++ b/pipeline/collector.py
@@ -4,6 +4,7 @@ import os
 
 from collections import OrderedDict
 
+import django
 from django.contrib.staticfiles import finders
 from django.contrib.staticfiles.storage import staticfiles_storage
 from django.utils import six
@@ -19,6 +20,11 @@ class Collector(object):
             storage = staticfiles_storage
         self.storage = storage
 
+    def _get_modified_time(self, storage, prefixed_path):
+        if django.VERSION[:2] >= (1, 10):
+            return storage.get_modified_time(prefixed_path)
+        return storage.modified_time(prefixed_path)
+
     def clear(self, path=""):
         dirs, files = self.storage.listdir(path)
         for f in files:
@@ -65,14 +71,14 @@ class Collector(object):
         if self.storage.exists(prefixed_path):
             try:
                 # When was the target file modified last time?
-                target_last_modified = self.storage.modified_time(prefixed_path)
+                target_last_modified = self._get_modified_time(self.storage, prefixed_path)
             except (OSError, NotImplementedError, AttributeError):
                 # The storage doesn't support ``modified_time`` or failed
                 pass
             else:
                 try:
                     # When was the source file modified last time?
-                    source_last_modified = source_storage.modified_time(path)
+                    source_last_modified = self._get_modified_time(source_storage, path)
                 except (OSError, NotImplementedError, AttributeError):
                     pass
                 else:
diff --git a/pipeline/compilers/__init__.py b/pipeline/compilers/__init__.py
index f9f7526..eb43157 100644
--- a/pipeline/compilers/__init__.py
+++ b/pipeline/compilers/__init__.py
@@ -1,6 +1,7 @@
 from __future__ import unicode_literals
 
 import os
+import shutil
 import subprocess
 from tempfile import NamedTemporaryFile
 
@@ -26,7 +27,7 @@ class Compiler(object):
     def compilers(self):
         return [to_class(compiler) for compiler in settings.COMPILERS]
 
-    def compile(self, paths, force=False):
+    def compile(self, paths, compiler_options={}, force=False):
         def _compile(input_path):
             for compiler in self.compilers:
                 compiler = compiler(verbose=self.verbose, storage=self.storage)
@@ -38,7 +39,8 @@ class Compiler(object):
                     outfile = compiler.output_path(infile, compiler.output_extension)
                     outdated = compiler.is_outdated(infile, outfile)
                     compiler.compile_file(infile, outfile,
-                                          outdated=outdated, force=force)
+                                          outdated=outdated, force=force,
+                                          **compiler_options)
 
                     return compiler.output_path(input_path, compiler.output_extension)
             else:
@@ -112,6 +114,9 @@ class SubProcessCompiler(CompilerBase):
             else:
                 argument_list.extend(flattening_arg)
 
+        # The first element in argument_list is the program that will be executed; if it is '', then
+        # a PermissionError will be raised. Thus empty arguments are filtered out from argument_list
+        argument_list = filter(None, argument_list)
         stdout = None
         try:
             # We always catch stdout in a file, but we may not have a use for it.
@@ -143,6 +148,6 @@ class SubProcessCompiler(CompilerBase):
             # Decide what to do with captured stdout.
             if stdout:
                 if stdout_captured:
-                    os.rename(stdout.name, os.path.join(cwd or os.curdir, stdout_captured))
+                    shutil.move(stdout.name, os.path.join(cwd or os.curdir, stdout_captured))
                 else:
                     os.remove(stdout.name)
diff --git a/pipeline/compressors/__init__.py b/pipeline/compressors/__init__.py
index 6043a24..8e1705e 100644
--- a/pipeline/compressors/__init__.py
+++ b/pipeline/compressors/__init__.py
@@ -16,7 +16,7 @@ from pipeline.conf import settings
 from pipeline.exceptions import CompressorError
 from pipeline.utils import to_class, relpath, set_std_streams_blocking
 
-URL_DETECTOR = r"""url\((['"]){0,1}\s*(.*?)["']{0,1}\)"""
+URL_DETECTOR = r"""url\((['"]?)\s*(.*?)\1\)"""
 URL_REPLACER = r"""url\(__EMBED__(.+?)(\?\d+)?\)"""
 NON_REWRITABLE_URL = re.compile(r'^(#|http:|https:|data:|//)')
 
@@ -62,7 +62,7 @@ class Compressor(object):
             js = js + self.compile_templates(templates)
 
         if not settings.DISABLE_WRAPPER:
-            js = "(function() {\n%s\n}).call(this);" % js
+            js = settings.JS_WRAPPER % js
 
         compressor = self.js_compressor
         if compressor:
diff --git a/pipeline/conf.py b/pipeline/conf.py
index b6dd5b7..085a1e2 100644
--- a/pipeline/conf.py
+++ b/pipeline/conf.py
@@ -38,6 +38,7 @@ DEFAULTS = {
     'TEMPLATE_SEPARATOR': "_",
 
     'DISABLE_WRAPPER': False,
+    'JS_WRAPPER': "(function() {\n%s\n}).call(this);",
 
     'CSSTIDY_BINARY': '/usr/bin/env csstidy',
     'CSSTIDY_ARGUMENTS': '--template=highest',
@@ -77,8 +78,6 @@ DEFAULTS = {
     'LESS_BINARY': '/usr/bin/env lessc',
     'LESS_ARGUMENTS': '',
 
-    'DISABLE_WRAPPER': False,
-
     'MIMETYPES': (
         (b'text/coffeescript', '.coffee'),
         (b'text/less', '.less'),
diff --git a/pipeline/finders.py b/pipeline/finders.py
index f0bec4b..4d1c535 100644
--- a/pipeline/finders.py
+++ b/pipeline/finders.py
@@ -4,6 +4,7 @@ from django.contrib.staticfiles.storage import staticfiles_storage
 from django.contrib.staticfiles.finders import BaseFinder, BaseStorageFinder, find, \
     AppDirectoriesFinder as DjangoAppDirectoriesFinder, FileSystemFinder as DjangoFileSystemFinder
 from django.utils._os import safe_join
+from os.path import normpath
 
 from pipeline.conf import settings
 
@@ -28,7 +29,7 @@ class ManifestFinder(BaseFinder):
         """
         matches = []
         for elem in chain(settings.STYLESHEETS.values(), settings.JAVASCRIPT.values()):
-            if elem['output_filename'] == path:
+            if normpath(elem['output_filename']) == normpath(path):
                 match = safe_join(settings.PIPELINE_ROOT, path)
                 if not all:
                     return match
diff --git a/pipeline/forms.py b/pipeline/forms.py
new file mode 100644
index 0000000..99d3691
--- /dev/null
+++ b/pipeline/forms.py
@@ -0,0 +1,273 @@
+"""Support for referencing Pipeline packages in forms and widgets."""
+
+from __future__ import unicode_literals
+
+from django.contrib.staticfiles.storage import staticfiles_storage
+from django.utils import six
+from django.utils.functional import cached_property
+
+from .collector import default_collector
+from .conf import settings
+from .packager import Packager
+
+
+class PipelineFormMediaProperty(object):
+    """A property that converts Pipeline packages to lists of files.
+
+    This is used behind the scenes for any Media classes that subclass
+    :py:class:`PipelineFormMedia`. When accessed, it converts any Pipeline
+    packages into lists of media files and returns or forwards on lookups to
+    that list.
+    """
+
+    def __init__(self, get_media_files_func, media_cls, extra_files):
+        """Initialize the property.
+
+        Args:
+            get_media_files_func (callable):
+                The function to call to generate the media files.
+
+            media_cls (type):
+                The Media class owning the property.
+
+            extra_files (object):
+                Files listed in the original ``css`` or ``js`` attribute on
+                the Media class.
+        """
+        self._get_media_files_func = get_media_files_func
+        self._media_cls = media_cls
+        self._extra_files = extra_files
+
+    @cached_property
+    def _media_files(self):
+        """The media files represented by the property."""
+        return self._get_media_files_func(self._media_cls, self._extra_files)
+
+    def __get__(self, *args, **kwargs):
+        """Return the media files when accessed as an attribute.
+
+        This is called when accessing the attribute directly through the
+        Media class (for example, ``Media.css``). It returns the media files
+        directly.
+
+        Args:
+            *args (tuple, unused):
+                Unused positional arguments.
+
+            **kwargs (dict, unused):
+                Unused keyword arguments.
+
+        Returns:
+            object:
+            The list or dictionary containing the media files definition.
+        """
+        return self._media_files
+
+    def __getattr__(self, attr_name):
+        """Return an attribute on the media files definition.
+
+        This is called when accessing an attribute that doesn't otherwise
+        exist in the property's dictionary. The call is forwarded onto the
+        media files definition.
+
+        Args:
+            attr_name (unicode):
+                The attribute name.
+
+        Returns:
+            object:
+            The attribute value.
+
+        Raises:
+            AttributeError:
+                An attribute with this name could not be found.
+        """
+        return getattr(self._media_files, attr_name)
+
+    def __iter__(self):
+        """Iterate through the media files definition.
+
+        This is called when attempting to iterate over this property. It
+        iterates over the media files definition instead.
+
+        Yields:
+            object:
+            Each entry in the media files definition.
+        """
+        return iter(self._media_files)
+
+
+class PipelineFormMediaMetaClass(type):
+    """Metaclass for the PipelineFormMedia class.
+
+    This is responsible for converting CSS/JavaScript packages defined in
+    Pipeline into lists of files to include on a page. It handles access to the
+    :py:attr:`css` and :py:attr:`js` attributes on the class, generating a
+    list of files to return based on the Pipelined packages and individual
+    files listed in the :py:attr:`css`/:py:attr:`css_packages` or
+    :py:attr:`js`/:py:attr:`js_packages` attributes.
+    """
+
+    def __new__(cls, name, bases, attrs):
+        """Construct the class.
+
+        Args:
+            name (bytes):
+                The name of the class.
+
+            bases (tuple):
+                The base classes for the class.
+
+            attrs (dict):
+                The attributes going into the class.
+
+        Returns:
+            type:
+            The new class.
+        """
+        new_class = super(PipelineFormMediaMetaClass, cls).__new__(
+            cls, name, bases, attrs)
+
+        # If we define any packages, we'll need to use our special
+        # PipelineFormMediaProperty class. We use this instead of intercepting
+        # in __getattribute__ because Django does not access them through
+        # normal properpty access. Instead, grabs the Media class's __dict__
+        # and accesses them from there. By using these special properties, we
+        # can handle direct access (Media.css) and dictionary-based access
+        # (Media.__dict__['css']).
+        if 'css_packages' in attrs:
+            new_class.css = PipelineFormMediaProperty(
+                cls._get_css_files, new_class, attrs.get('css') or {})
+
+        if 'js_packages' in attrs:
+            new_class.js = PipelineFormMediaProperty(
+                cls._get_js_files, new_class, attrs.get('js') or [])
+
+        return new_class
+
+    def _get_css_files(cls, extra_files):
+        """Return all CSS files from the Media class.
+
+        Args:
+            extra_files (dict):
+                The contents of the Media class's original :py:attr:`css`
+                attribute, if one was provided.
+
+        Returns:
+            dict:
+            The CSS media types and files to return for the :py:attr:`css`
+            attribute.
+        """
+        packager = Packager()
+        css_packages = getattr(cls, 'css_packages', {})
+
+        return dict(
+            (media_target,
+             cls._get_media_files(packager=packager,
+                                  media_packages=media_packages,
+                                  media_type='css',
+                                  extra_files=extra_files.get(media_target,
+                                                              [])))
+            for media_target, media_packages in six.iteritems(css_packages)
+        )
+
+    def _get_js_files(cls, extra_files):
+        """Return all JavaScript files from the Media class.
+
+        Args:
+            extra_files (list):
+                The contents of the Media class's original :py:attr:`js`
+                attribute, if one was provided.
+
+        Returns:
+            list:
+            The JavaScript files to return for the :py:attr:`js` attribute.
+        """
+        return cls._get_media_files(
+            packager=Packager(),
+            media_packages=getattr(cls, 'js_packages', {}),
+            media_type='js',
+            extra_files=extra_files)
+
+    def _get_media_files(cls, packager, media_packages, media_type,
+                         extra_files):
+        """Return source or output media files for a list of packages.
... 738 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/django-pipeline.git



More information about the Python-modules-commits mailing list