Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-django-compressor for openSUSE:Factory checked in at 2022-08-05 19:51:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-django-compressor (Old) and /work/SRC/openSUSE:Factory/.python-django-compressor.new.1521 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-django-compressor" Fri Aug 5 19:51:10 2022 rev:7 rq:993153 version:4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-django-compressor/python-django-compressor.changes 2022-04-27 21:41:13.121005751 +0200 +++ /work/SRC/openSUSE:Factory/.python-django-compressor.new.1521/python-django-compressor.changes 2022-08-05 19:52:09.809635774 +0200 @@ -1,0 +2,19 @@ +Thu Aug 4 17:45:11 UTC 2022 - Ben Greiner <c...@bnavigator.de> + +- Update to 4.1 + * Add Django 4.1 compatibility + * New setting ``COMPRESS_OFFLINE_MANIFEST_STORAGE`` to customize + the offline manifest's file storage (#1112) With this change + the function + ``compressor.cache.get_offline_manifest_filename()`` has been + removed. You can now use the new file storage + ``compressor.storage.default_offline_manifest_storage`` to + access the location of the manifest. +- Release 4.0 + * Fix intermittent No such file or directory errors by changing + strategy to deal with duplicate filenames in + CompressorFileStorage + * Deprecate SlimItFilter, stop testing it with Python 3.7 or + higher + +------------------------------------------------------------------- Old: ---- django_compressor-3.1.tar.gz New: ---- django_compressor-4.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-django-compressor.spec ++++++ --- /var/tmp/diff_new_pack.MZ8Z6T/_old 2022-08-05 19:52:10.309637065 +0200 +++ /var/tmp/diff_new_pack.MZ8Z6T/_new 2022-08-05 19:52:10.313637075 +0200 @@ -16,11 +16,11 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%{?!python_module:%define python_module() python3-%{**}} %define mod_name django_compressor %define skip_python2 1 Name: python-django-compressor -Version: 3.1 +Version: 4.1 Release: 0 Summary: Python module to compress linked/inline JavaScript/CSS to cached files License: Apache-2.0 AND BSD-3-Clause AND MIT @@ -65,13 +65,17 @@ %prep %setup -q -n %{mod_name}-%{version} +sed -i '1{/env python/d}' compressor/tests/precompiler.py %build %python_build %install %python_install -%python_expand %fdupes %{buildroot}%{$python_sitelib} +%{python_expand # +echo '/* empty file */' >> %{buildroot}%{$python_sitelib}/compressor/tests/static/CACHE/css/output.e3b0c44298fc.css +%fdupes %{buildroot}%{$python_sitelib} +} %check %python_expand $python -m django test --settings=compressor.test_settings compressor --pythonpath=`pwd` -v2 @@ -79,6 +83,7 @@ %files %{python_files} %license LICENSE %doc AUTHORS README.rst -%{python_sitelib}/* +%{python_sitelib}/compressor +%{python_sitelib}/django_compressor-%{version}*-info %changelog ++++++ django_compressor-3.1.tar.gz -> django_compressor-4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/LICENSE new/django_compressor-4.1/LICENSE --- old/django_compressor-3.1/LICENSE 2021-05-01 13:21:12.000000000 +0200 +++ new/django_compressor-4.1/LICENSE 2022-04-23 12:19:10.000000000 +0200 @@ -1,6 +1,6 @@ django_compressor ----------------- -Copyright (c) 2009-2015 Django Compressor authors (see AUTHORS file) +Copyright (c) 2009-2022 Django Compressor authors (see AUTHORS file) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -42,87 +42,3 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -rjsmin.py (License-information from the file) ---------------------------------------------- -Copyright 2006, 2007, 2008, 2009, 2010, 2011 -Andr?? Malo or his licensors, as applicable - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - - -utils.cache.cached_property extracted from Celery -------------------------------------------- -Copyright (c) 2009-2011, Ask Solem and contributors. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -Neither the name of Ask Solem nor the names of its contributors may be used -to endorse or promote products derived from this software without specific -prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -utils.FormattableString ------------------------ -Copyright (c) 2010 by Florent Xicluna. - -Some rights reserved. - -Redistribution and use in source and binary forms of the software as well -as documentation, with or without modification, are permitted provided -that the following conditions are met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - -* The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND -CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT -NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER -OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/PKG-INFO new/django_compressor-4.1/PKG-INFO --- old/django_compressor-3.1/PKG-INFO 2021-12-18 21:24:37.309890000 +0100 +++ new/django_compressor-4.1/PKG-INFO 2022-08-03 18:07:20.773594000 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 2.1 Name: django_compressor -Version: 3.1 +Version: 4.1 Summary: Compresses linked and inline JavaScript or CSS into single cached files. Home-page: https://django-compressor.readthedocs.io/en/latest/ Author: Jannis Leidel Author-email: jan...@leidel.info License: MIT -Platform: UNKNOWN +Project-URL: Source, https://github.com/django-compressor/django-compressor Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: Django Classifier: Framework :: Django :: 2.2 @@ -106,5 +106,3 @@ .. _data URIs: http://en.wikipedia.org/wiki/Data_URI_scheme .. _django-compressor.readthedocs.org: https://django-compressor.readthedocs.io/en/latest/ .. _github.com/django-compressor/django-compressor: https://github.com/django-compressor/django-compressor - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/compressor/__init__.py new/django_compressor-4.1/compressor/__init__.py --- old/django_compressor-3.1/compressor/__init__.py 2021-12-18 21:23:39.000000000 +0100 +++ new/django_compressor-4.1/compressor/__init__.py 2022-08-03 18:04:55.000000000 +0200 @@ -1,2 +1,2 @@ # following PEP 386 -__version__ = "3.1" +__version__ = "4.1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/compressor/cache.py new/django_compressor-4.1/compressor/cache.py --- old/django_compressor-3.1/compressor/cache.py 2021-12-12 19:04:27.000000000 +0100 +++ new/django_compressor-4.1/compressor/cache.py 2022-08-03 18:03:37.000000000 +0200 @@ -11,7 +11,7 @@ from django.utils.functional import SimpleLazyObject from compressor.conf import settings -from compressor.storage import default_storage +from compressor.storage import default_offline_manifest_storage from compressor.utils import get_mod_func _cachekey_func = None @@ -66,20 +66,15 @@ return get_cachekey("offline.%s" % get_offline_hexdigest(source)) -def get_offline_manifest_filename(): - output_dir = settings.COMPRESS_OUTPUT_DIR.strip('/') - return os.path.join(output_dir, settings.COMPRESS_OFFLINE_MANIFEST) - - _offline_manifest = None def get_offline_manifest(): global _offline_manifest if _offline_manifest is None: - filename = get_offline_manifest_filename() - if default_storage.exists(filename): - with default_storage.open(filename) as fp: + filename = settings.COMPRESS_OFFLINE_MANIFEST + if default_offline_manifest_storage.exists(filename): + with default_offline_manifest_storage.open(filename) as fp: _offline_manifest = json.loads(fp.read().decode('utf8')) else: _offline_manifest = {} @@ -92,9 +87,8 @@ def write_offline_manifest(manifest): - filename = get_offline_manifest_filename() content = json.dumps(manifest, indent=2).encode('utf8') - default_storage.save(filename, ContentFile(content)) + default_offline_manifest_storage.save(settings.COMPRESS_OFFLINE_MANIFEST, ContentFile(content)) flush_offline_manifest() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/compressor/conf.py new/django_compressor-4.1/compressor/conf.py --- old/django_compressor-3.1/compressor/conf.py 2021-12-12 19:04:27.000000000 +0100 +++ new/django_compressor-4.1/compressor/conf.py 2022-08-03 18:03:37.000000000 +0200 @@ -75,6 +75,7 @@ OFFLINE_CONTEXT = {} # The name of the manifest file (e.g. filename.ext) OFFLINE_MANIFEST = 'manifest.json' + OFFLINE_MANIFEST_STORAGE = 'compressor.storage.OfflineManifestFileStorage' # The Context to be used when TemplateFilter is used TEMPLATE_FILTER_CONTEXT = {} # Placeholder to be used instead of settings.COMPRESS_URL during offline compression. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/compressor/filters/jsmin/__init__.py new/django_compressor-4.1/compressor/filters/jsmin/__init__.py --- old/django_compressor-3.1/compressor/filters/jsmin/__init__.py 2021-12-12 19:04:27.000000000 +0100 +++ new/django_compressor-4.1/compressor/filters/jsmin/__init__.py 2022-04-23 12:19:10.000000000 +0200 @@ -1,3 +1,5 @@ +import warnings + from django.core.exceptions import ImproperlyConfigured from compressor.filters import FilterBase, CallbackOutputFilter @@ -6,9 +8,7 @@ class rJSMinFilter(CallbackOutputFilter): callback = "rjsmin.jsmin" dependencies = ["rjsmin"] - kwargs = { - "keep_bang_comments": True - } + kwargs = {"keep_bang_comments": True} # This is for backwards compatibility @@ -22,6 +22,14 @@ "mangle": True, } + def __init__(self, *args, **kwargs): + warnings.warn( + "SlimItFilter is broken in Python 3.6+ and will be removed in " + "django-compressor 3.3.", + DeprecationWarning, + ) + super().__init__(*args, **kwargs) + class CalmjsFilter(FilterBase): def __init__(self, *args, **kwargs): @@ -39,7 +47,8 @@ except ImportError: raise ImproperlyConfigured( "The module calmjs.parse couldn't be imported. " - "Make sure it is correctly installed.") + "Make sure it is correctly installed." + ) if self._parser is None: self._parser = calmjs.parse.es5 if self._unparser is None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/compressor/management/commands/compress.py new/django_compressor-4.1/compressor/management/commands/compress.py --- old/django_compressor-3.1/compressor/management/commands/compress.py 2021-12-18 21:23:39.000000000 +0100 +++ new/django_compressor-4.1/compressor/management/commands/compress.py 2022-08-03 18:03:37.000000000 +0200 @@ -27,6 +27,11 @@ class Command(BaseCommand): help = "Compress content outside of the request/response cycle" + if django.VERSION >= (3, 2): + requires_system_checks = [] + else: + requires_system_checks = False + def add_arguments(self, parser): parser.add_argument('--extension', '-e', action='append', dest='extensions', help='The file extension(s) to examine (default: ".html", ' @@ -322,5 +327,3 @@ final_offline_manifest.update(offline_manifest) write_offline_manifest(final_offline_manifest) return final_block_count, final_results - -Command.requires_system_checks = False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/compressor/storage.py new/django_compressor-4.1/compressor/storage.py --- old/django_compressor-3.1/compressor/storage.py 2021-12-12 19:04:27.000000000 +0100 +++ new/django_compressor-4.1/compressor/storage.py 2022-08-03 18:03:37.000000000 +0200 @@ -2,6 +2,7 @@ import os from datetime import datetime import time +from urllib.parse import urljoin from django.core.files.storage import FileSystemStorage, get_storage_class from django.utils.functional import LazyObject, SimpleLazyObject @@ -33,13 +34,16 @@ def modified_time(self, name): return datetime.fromtimestamp(os.path.getmtime(self.path(name))) - def get_available_name(self, name, max_length=None): - """ - Deletes the given file if it exists. - """ - if self.exists(name): - self.delete(name) - return name + def save(self, filename, content): + temp_filename = super().save(filename, content) + # If a file already exists in the target location, FileSystemStorage + # will generate an unique filename and save content there instead. + # When that happens, we move the file to the intended location using + # os.replace() (which is an atomic operation): + if temp_filename != filename: + os.replace(self.path(temp_filename), self.path(filename)) + + return filename compressor_file_storage = SimpleLazyObject( @@ -107,3 +111,20 @@ default_storage = DefaultStorage() + + +class OfflineManifestFileStorage(CompressorFileStorage): + def __init__(self, location=None, base_url=None, *args, **kwargs): + if location is None: + location = os.path.join(settings.COMPRESS_ROOT, settings.COMPRESS_OUTPUT_DIR) + if base_url is None: + base_url = urljoin(settings.COMPRESS_URL, settings.COMPRESS_OUTPUT_DIR) + super().__init__(location, base_url, *args, **kwargs) + + +class DefaultOfflineManifestStorage(LazyObject): + def _setup(self): + self._wrapped = get_storage_class(settings.COMPRESS_OFFLINE_MANIFEST_STORAGE)() + + +default_offline_manifest_storage = DefaultOfflineManifestStorage() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/compressor/tests/test_filters.py new/django_compressor-4.1/compressor/tests/test_filters.py --- old/django_compressor-3.1/compressor/tests/test_filters.py 2021-12-12 19:04:27.000000000 +0100 +++ new/django_compressor-4.1/compressor/tests/test_filters.py 2022-04-23 12:19:10.000000000 +0200 @@ -2,7 +2,7 @@ import os import sys from collections import defaultdict -from unittest import mock +from unittest import mock, skipIf from django.conf import settings from django.test import override_settings, TestCase @@ -202,6 +202,7 @@ self.assertEqual(output, rJSMinFilter(content).output()) +@skipIf(sys.version_info >= (3, 7), reason="Unsupported in Python 3.7+") class SlimItTestCase(TestCase): def test_slimit_filter(self): content = """ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/compressor/tests/test_offline.py new/django_compressor-4.1/compressor/tests/test_offline.py --- old/django_compressor-3.1/compressor/tests/test_offline.py 2021-12-18 21:23:39.000000000 +0100 +++ new/django_compressor-4.1/compressor/tests/test_offline.py 2022-08-03 18:03:37.000000000 +0200 @@ -15,7 +15,7 @@ from compressor.cache import flush_offline_manifest, get_offline_manifest from compressor.exceptions import OfflineGenerationError from compressor.management.commands.compress import Command as CompressCommand -from compressor.storage import default_storage +from compressor.storage import default_offline_manifest_storage from compressor.utils import get_mod_func @@ -154,9 +154,9 @@ def tearDown(self): self.override_settings.__exit__(None, None, None) - manifest_path = os.path.join('CACHE', 'manifest.json') - if default_storage.exists(manifest_path): - default_storage.delete(manifest_path) + manifest_filename = 'manifest.json' + if default_offline_manifest_storage.exists(manifest_filename): + default_offline_manifest_storage.delete(manifest_filename) def _prepare_contexts(self, engine): contexts = settings.COMPRESS_OFFLINE_CONTEXT @@ -311,9 +311,9 @@ def _test_deleting_manifest_does_not_affect_rendering(self, engine): count, result = CompressCommand().handle_inner(engines=[engine], verbosity=0) get_offline_manifest() - manifest_path = os.path.join('CACHE', 'manifest.json') - if default_storage.exists(manifest_path): - default_storage.delete(manifest_path) + manifest_filename = 'manifest.json' + if default_offline_manifest_storage.exists(manifest_filename): + default_offline_manifest_storage.delete(manifest_filename) self.assertEqual(1, count) self.assertEqual([self._render_script(self.expected_hash)], result) rendered_template = self._render_template(engine) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/compressor/tests/test_storages.py new/django_compressor-4.1/compressor/tests/test_storages.py --- old/django_compressor-3.1/compressor/tests/test_storages.py 2021-12-12 19:04:27.000000000 +0100 +++ new/django_compressor-4.1/compressor/tests/test_storages.py 2022-08-03 18:03:37.000000000 +0200 @@ -61,3 +61,15 @@ context = {'STATIC_URL': settings.COMPRESS_URL} out = css_tag("/static/CACHE/css/output.e701f86c6430.css") self.assertEqual(out, render(template, context)) + + def test_duplicate_save_overwrites_same_file(self): + filename1 = self.default_storage.save('test.txt', ContentFile('yeah yeah')) + filename2 = self.default_storage.save('test.txt', ContentFile('yeah yeah')) + self.assertEqual(filename1, filename2) + self.assertNotIn("_", filename2) + + def test_offline_manifest_storage(self): + storage.default_offline_manifest_storage.save('test.txt', ContentFile('yeah yeah')) + self.assertTrue(os.path.exists(os.path.join(settings.COMPRESS_ROOT, 'CACHE', 'test.txt'))) + # Check that the file is stored at the same default location as before the new manifest storage. + self.assertTrue(self.default_storage.exists(os.path.join('CACHE', 'test.txt'))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/django_compressor.egg-info/PKG-INFO new/django_compressor-4.1/django_compressor.egg-info/PKG-INFO --- old/django_compressor-3.1/django_compressor.egg-info/PKG-INFO 2021-12-18 21:24:37.000000000 +0100 +++ new/django_compressor-4.1/django_compressor.egg-info/PKG-INFO 2022-08-03 18:07:20.000000000 +0200 @@ -1,12 +1,12 @@ Metadata-Version: 2.1 Name: django-compressor -Version: 3.1 +Version: 4.1 Summary: Compresses linked and inline JavaScript or CSS into single cached files. Home-page: https://django-compressor.readthedocs.io/en/latest/ Author: Jannis Leidel Author-email: jan...@leidel.info License: MIT -Platform: UNKNOWN +Project-URL: Source, https://github.com/django-compressor/django-compressor Classifier: Development Status :: 5 - Production/Stable Classifier: Framework :: Django Classifier: Framework :: Django :: 2.2 @@ -106,5 +106,3 @@ .. _data URIs: http://en.wikipedia.org/wiki/Data_URI_scheme .. _django-compressor.readthedocs.org: https://django-compressor.readthedocs.io/en/latest/ .. _github.com/django-compressor/django-compressor: https://github.com/django-compressor/django-compressor - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/docs/changelog.txt new/django_compressor-4.1/docs/changelog.txt --- old/django_compressor-3.1/docs/changelog.txt 2021-12-18 21:23:39.000000000 +0100 +++ new/django_compressor-4.1/docs/changelog.txt 2022-08-03 18:06:54.000000000 +0200 @@ -1,6 +1,28 @@ Changelog ========= +v4.1 (2022-08-03) +----------------- + +- Add Django 4.1 compatibility + +- New setting ``COMPRESS_OFFLINE_MANIFEST_STORAGE`` to customize the offline manifest's file storage (#1112) + + With this change the function ``compressor.cache.get_offline_manifest_filename()`` has been removed. + You can now use the new file storage ``compressor.storage.default_offline_manifest_storage`` to access the + location of the manifest. + + +v4.0 (2022-03-23) +----------------- + +`Full Changelog <https://github.com/django-compressor/django-compressor/compare/3.1...4.0>`_ + +- Fix intermittent No such file or directory errors by changing strategy to + deal with duplicate filenames in CompressorFileStorage +- Deprecate SlimItFilter, stop testing it with Python 3.7 or higher + + v3.1 (2021-12-18) ----------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/docs/quickstart.txt new/django_compressor-4.1/docs/quickstart.txt --- old/django_compressor-3.1/docs/quickstart.txt 2021-12-12 19:04:27.000000000 +0100 +++ new/django_compressor-4.1/docs/quickstart.txt 2022-04-23 12:19:10.000000000 +0200 @@ -64,13 +64,6 @@ pip install html5lib -- `Slim It`_ - - For the :ref:`Slim It filter <slimit_filter>` - ``compressor.filters.jsmin.SlimItFilter``:: - - pip install slimit - - `Calmjs`_ For the :ref:`Calmjs filter <calmjs_filter>` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/docs/settings.txt new/django_compressor-4.1/docs/settings.txt --- old/django_compressor-3.1/docs/settings.txt 2021-12-12 19:04:27.000000000 +0100 +++ new/django_compressor-4.1/docs/settings.txt 2022-08-03 18:03:37.000000000 +0200 @@ -69,7 +69,7 @@ .. attribute:: COMPRESS_FILTERS - :default: ``{'css': ['compressor.filters.css_default.CssAbsoluteFilter'], 'js': ['compressor.filters.jsmin.JSMinFilter']}`` + :default: ``{'css': ['compressor.filters.css_default.CssAbsoluteFilter', 'compressor.filters.cssmin.rCSSMinFilter'], 'js': ['compressor.filters.jsmin.rJSMinFilter']}`` A mapping of resource kinds to the list of filters to apply. The key is used to refer to this resource type in templates @@ -83,7 +83,7 @@ .. _compress_css_filters: - :default: ``['compressor.filters.css_default.CssAbsoluteFilter']`` + :default: ``['compressor.filters.css_default.CssAbsoluteFilter', 'compressor.filters.cssmin.rCSSMinFilter']`` A list of filters that will be applied to CSS. @@ -190,24 +190,17 @@ .. _compress_js_filters: - :Default: ``['compressor.filters.jsmin.JSMinFilter']`` + :Default: ``['compressor.filters.jsmin.rJSMinFilter']`` A list of filters that will be applied to javascript. Possible options are: - - ``compressor.filters.jsmin.JSMinFilter`` + - ``compressor.filters.jsmin.rJSMinFilter`` A filter that uses the jsmin implementation rJSmin_ to compress JavaScript code (installed by default). - .. _slimit_filter: - - - ``compressor.filters.jsmin.SlimItFilter`` - - A filter that uses the jsmin implementation `Slim It`_ to compress - JavaScript code. - .. _calmjs_filter: - ``compressor.filters.jsmin.CalmjsFilter`` @@ -548,3 +541,26 @@ The name of the file to be used for saving the names of the files compressed offline. + +.. attribute:: COMPRESS_OFFLINE_MANIFEST_STORAGE + + :Default: ``compressor.storage.OfflineManifestFileStorage`` + + The dotted path to a Django Storage backend to be used to save the + offline manifest. + + By default, the file configured with + :attr:`~django.conf.settings.COMPRESS_OFFLINE_MANIFEST` will be stored + into :attr:`~django.conf.settings.COMPRESS_OUTPUT_DIR`. + + An example to output the manifest into the project's root directory:: + + # project/settings.py: + COMPRESS_STORAGE = 'project.module.PrivateOfflineManifestFileStorage' + + # project/module.py: + from compressor.storage import OfflineManifestFileStorage + from django.conf import settings + class PrivateOfflineManifestFileStorage(OfflineManifestFileStorage): + def __init__(self, *args, **kwargs): + super().__init__(settings.BASE_DIR, None, *args, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/docs/usage.txt new/django_compressor-4.1/docs/usage.txt --- old/django_compressor-3.1/docs/usage.txt 2021-05-01 13:21:12.000000000 +0200 +++ new/django_compressor-4.1/docs/usage.txt 2022-08-03 18:03:37.000000000 +0200 @@ -79,6 +79,25 @@ <script type="text/javascript" src="/static/CACHE/js/base.3f33b9146e12.js" charset="utf-8"></script> +Javascript ``async`` and ``defer`` are supported: + + .. code-block:: django + + {% compress js %} + <script src="/static/js/one.js" async></script> + {% endcompress %} + {% compress js %} + <script src="/static/js/one.js" defer></script> + {% endcompress %} + +Result: + + .. code-block:: django + + <script async src="/static/CACHE/js/output.ccbb802fbf33.js"></script> + <script defer src="/static/CACHE/js/output.5bd495b0eb05.js"></script> + + .. note:: Remember that django-compressor will try to :ref:`group outputs by media <css_notes>`. @@ -112,7 +131,7 @@ Django's `caching documentation`_). .. _memcached: http://memcached.org/ -.. _caching documentation: https://docs.djangoproject.com/en/2.1/topics/cache/#memcached +.. _caching documentation: https://docs.djangoproject.com/en/stable/topics/cache/#memcached .. _offline_compression: @@ -161,7 +180,7 @@ <django.conf.settings.COMPRESS_STORAGE>` to be able to be transferred from your development computer to the server easily. -.. _TEMPLATE_LOADERS: http://docs.djangoproject.com/en/dev/ref/settings/#template-loaders +.. _TEMPLATE_LOADERS: http://docs.djangoproject.com/en/stable/ref/settings/#template-loaders .. _signals: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/requirements/tests.txt new/django_compressor-4.1/requirements/tests.txt --- old/django_compressor-3.1/requirements/tests.txt 2021-12-18 21:23:39.000000000 +0100 +++ new/django_compressor-4.1/requirements/tests.txt 2022-08-03 18:03:59.000000000 +0200 @@ -1,13 +1,13 @@ Jinja2==3.0.3 -beautifulsoup4==4.9.3 +beautifulsoup4==4.11.1 brotli==1.0.9 calmjs==3.4.2 coverage==5.5 csscompressor==0.9.5 django-sekizai==2.0.0 -flake8==3.9.1 +flake8==4.0.1 html5lib==1.1 -lxml==4.6.5 -rcssmin==1.1.0 +lxml==4.9.1 +rcssmin==1.1.1 rjsmin==1.2.0 slimit==0.8.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/setup.py new/django_compressor-4.1/setup.py --- old/django_compressor-3.1/setup.py 2021-12-12 19:20:53.000000000 +0100 +++ new/django_compressor-4.1/setup.py 2022-04-23 12:19:10.000000000 +0200 @@ -117,6 +117,9 @@ name="django_compressor", version=find_version("compressor", "__init__.py"), url='https://django-compressor.readthedocs.io/en/latest/', + project_urls={ + 'Source': 'https://github.com/django-compressor/django-compressor', + }, license='MIT', description="Compresses linked and inline JavaScript or CSS into single cached files.", long_description=read('README.rst'), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django_compressor-3.1/tox.ini new/django_compressor-4.1/tox.ini --- old/django_compressor-3.1/tox.ini 2021-12-12 19:04:27.000000000 +0100 +++ new/django_compressor-4.1/tox.ini 2022-08-03 18:03:59.000000000 +0200 @@ -3,7 +3,8 @@ {py36,py37,py38,py39}-2.2.X {py36,py37,py38,py39}-3.1.X {py36,py37,py38,py39,py310}-3.2.X - {py38,py39,,py310}-4.0.X + {py38,py39,py310}-4.0.X + {py38,py39,py310}-4.1.X [testenv] basepython = py36: python3.6 @@ -22,5 +23,6 @@ 2.2.X: Django>=2.2,<2.3 3.1.X: Django>=3.1,<3.2 3.2.X: Django>=3.2,<4.0 - 4.0.X: Django>=4.0a1,<5.0 + 4.0.X: Django>=4.0,<4.1 + 4.1.X: Django>=4.1,<4.2 -r{toxinidir}/requirements/tests.txt