[Python-modules-commits] [django-pipeline] 02/07: Make JSMin dependency optional

Brian May bam at moszumanska.debian.org
Sun Jan 3 02:44:27 UTC 2016


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

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

commit e57248ca545fb290aae3baa36398d9209e4ab16b
Author: Dmitry Nezhevenko <dion at dion.org.ua>
Date:   Thu Oct 8 08:55:54 2015 -0700

    Make JSMin dependency optional
    
     JSMin is a JavaScript compressor. It's known to be non-free due to
     additional statement to MIT license (The Software shall be used for Good,
     not Evil.)
     .
     This patchs stubs out JSMin usage. Instead uncompressed JS will be
     returned. This should be ok since it is not default compressor at all.
    Bug: https://github.com/cyberdelia/django-pipeline/issues/99
    Patch-Name: make_jsmin_optional
---
 pipeline/compressors/jsmin.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pipeline/compressors/jsmin.py b/pipeline/compressors/jsmin.py
index dd1fc73..3ed6c66 100644
--- a/pipeline/compressors/jsmin.py
+++ b/pipeline/compressors/jsmin.py
@@ -9,5 +9,9 @@ class JSMinCompressor(CompressorBase):
     (http://pypi.python.org/pypi/jsmin/).
     """
     def compress_js(self, js):
-        from jsmin import jsmin
-        return jsmin(js)
+        try:
+            from jsmin import jsmin
+            return jsmin(js)
+        except ImportError:
+            # JSMin is not available
+            return js

-- 
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