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

Brian May bam at moszumanska.debian.org
Wed Mar 23 00:29:08 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 96b2c88a16df4ae37176323b6dca092de073f3dd
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