Hello community, here is the log from the commit of package python-django-webpack-loader for openSUSE:Factory checked in at 2020-04-04 12:25:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-django-webpack-loader (Old) and /work/SRC/openSUSE:Factory/.python-django-webpack-loader.new.3248 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-django-webpack-loader" Sat Apr 4 12:25:58 2020 rev:3 rq:791161 version:0.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-django-webpack-loader/python-django-webpack-loader.changes 2019-06-03 18:56:03.124413683 +0200 +++ /work/SRC/openSUSE:Factory/.python-django-webpack-loader.new.3248/python-django-webpack-loader.changes 2020-04-04 12:26:50.136015014 +0200 @@ -1,0 +2,6 @@ +Fri Apr 3 10:25:09 UTC 2020 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 0.7.0: + * Added support for custom loader classes + +------------------------------------------------------------------- Old: ---- 0.6.0.tar.gz New: ---- 0.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-django-webpack-loader.spec ++++++ --- /var/tmp/diff_new_pack.nM3Ztq/_old 2020-04-04 12:26:51.152016064 +0200 +++ /var/tmp/diff_new_pack.nM3Ztq/_new 2020-04-04 12:26:51.156016068 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-django-webpack-loader # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,21 +18,21 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-django-webpack-loader -Version: 0.6.0 +Version: 0.7.0 Release: 0 Summary: Django plugin to transparently use webpack License: MIT Group: Development/Languages/Python URL: https://github.com/owais/django-webpack-loader Source: https://github.com/owais/django-webpack-loader/archive/%{version}.tar.gz -BuildRequires: %{python_module Django >= 1.8} +BuildRequires: %{python_module Django >= 1.10} BuildRequires: %{python_module django-jinja} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module unittest2} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-Django >= 1.8 +Requires: python-Django >= 1.10 Recommends: python-django-jinja BuildArch: noarch %python_subpackages ++++++ 0.6.0.tar.gz -> 0.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/.circleci/config.yml new/django-webpack-loader-0.7.0/.circleci/config.yml --- old/django-webpack-loader-0.6.0/.circleci/config.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/django-webpack-loader-0.7.0/.circleci/config.yml 2020-01-13 21:57:18.000000000 +0100 @@ -0,0 +1,168 @@ +version: 2 +workflows: + version: 2 + test: + jobs: + - test-3.4-18 + - test-3.4-19 + - test-3.4-110 + - test-3.4-111 + + - test-3.5-18 + - test-3.5-19 + - test-3.5-110 + - test-3.5-111 + + - test-3.6-18 + - test-3.6-19 + - test-3.6-110 + - test-3.6-111 + + - test-3.7-18 + - test-3.7-19 + - test-3.7-110 + - test-3.7-111 +jobs: + base: &test-template + docker: + - image: circleci/python:3.4-stretch-node + working_directory: ~/repo + steps: + - checkout + - run: + name: python version + command: python --version + + - restore_cache: + keys: + - v1-js + - restore_cache: + keys: + - v1-py + + - run: + name: JS deps + command: cd tests && yarn + - save_cache: + paths: + - ./npm + key: v1-js + + - run: + name: setup python + command: | + python3 -m venv venv + source venv/bin/activate + rm -f requirements.txt + pip install -r tests/requirements/common.txt + pip install -r tests/requirements/django${DJANGO_VERSION}.txt + - save_cache: + paths: + - ./cache/pip + key: v1-py + + - run: + name: Run tests + command: | + source venv/bin/activate + cd tests + coverage run --source=webpack_loader manage.py test + test-3.4-18: + <<: *test-template + docker: + - image: circleci/python:3.4-stretch-node + environment: + DJANGO_VERSION: "18" + test-3.4-19: + <<: *test-template + docker: + - image: circleci/python:3.4-stretch-node + environment: + DJANGO_VERSION: "19" + test-3.4-110: + <<: *test-template + docker: + - image: circleci/python:3.4-stretch-node + environment: + DJANGO_VERSION: "110" + test-3.4-111: + <<: *test-template + docker: + - image: circleci/python:3.4-stretch-node + environment: + DJANGO_VERSION: "111" + + test-3.5-18: + <<: *test-template + docker: + - image: circleci/python:3.5-stretch-node + environment: + DJANGO_VERSION: "18" + test-3.5-19: + <<: *test-template + docker: + - image: circleci/python:3.5-stretch-node + environment: + DJANGO_VERSION: "19" + test-3.5-110: + <<: *test-template + docker: + - image: circleci/python:3.5-stretch-node + environment: + DJANGO_VERSION: "110" + test-3.5-111: + <<: *test-template + docker: + - image: circleci/python:3.5-stretch-node + environment: + DJANGO_VERSION: "111" + + test-3.6-18: + <<: *test-template + docker: + - image: circleci/python:3.6-stretch-node + environment: + DJANGO_VERSION: "18" + test-3.6-19: + <<: *test-template + docker: + - image: circleci/python:3.6-stretch-node + environment: + DJANGO_VERSION: "19" + test-3.6-110: + <<: *test-template + docker: + - image: circleci/python:3.6-stretch-node + environment: + DJANGO_VERSION: "110" + test-3.6-111: + <<: *test-template + docker: + - image: circleci/python:3.6-stretch-node + environment: + DJANGO_VERSION: "111" + + test-3.7-18: + <<: *test-template + docker: + - image: circleci/python:3.7-stretch-node + environment: + DJANGO_VERSION: "18" + test-3.7-19: + <<: *test-template + docker: + - image: circleci/python:3.7-stretch-node + environment: + DJANGO_VERSION: "19" + test-3.7-110: + <<: *test-template + docker: + - image: circleci/python:3.7-stretch-node + environment: + DJANGO_VERSION: "110" + test-3.7-111: + <<: *test-template + docker: + - image: circleci/python:3.7-stretch-node + environment: + DJANGO_VERSION: "111" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/.travis.yml new/django-webpack-loader-0.7.0/.travis.yml --- old/django-webpack-loader-0.6.0/.travis.yml 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,41 +0,0 @@ -language: python -sudo: false -# command to install dependencies -before_install: "cd tests" -install: travis_retry pip install 'tox<3.0' coveralls -# command to run tests -script: - - npm install - - tox -e "${TOXENV}" -after_success: - - coverage xml - - cp coverage.xml ../ - - coveralls -env: - matrix: - - TOXENV=py26-django16 - - TOXENV=py27-django16 - - TOXENV=py27-django17 - - TOXENV=py33-django17 - - TOXENV=py34-django17 - - TOXENV=py27-django18 - - TOXENV=py33-django18 - - TOXENV=py34-django18 - - TOXENV=py27-django19 - - TOXENV=py34-django19 - - TOXENV=py27-django110 - - TOXENV=py34-django110 - - TOXENV=py27-django111 - - TOXENV=py34-django111 -# Python 3.5 has to go here until Travis adds it to the default build images. -# https://github.com/travis-ci/travis-ci/issues/4794#issuecomment-143758799 -matrix: - include: - - python: 3.5 - env: TOXENV=py35-django18 - - python: 3.5 - env: TOXENV=py35-django19 - - python: 3.5 - env: TOXENV=py35-django110 - - python: 3.5 - env: TOXENV=py35-django111 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/Makefile new/django-webpack-loader-0.7.0/Makefile --- old/django-webpack-loader-0.6.0/Makefile 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/Makefile 2020-01-13 21:57:18.000000000 +0100 @@ -18,17 +18,15 @@ build: clean @echo "Building..." + @pip install -U setuptools @python setup.py sdist bdist_wheel --universal install: @echo "Installing build dependencies" - @[ ! -d $(ENV)/ ] && virtualenv $(ENV)/ || : + @[ ! -d $(ENV)/ ] && python3 -m venv $(ENV)/ || : @$(ENV)/bin/pip install $(requirements) -generate-rst: - @pandoc --from=markdown --to=rst --output=README.rst README.md - -publish: generate-rst build +publish: build @echo "Publishing to pypi..." @$(ENV)/bin/twine upload -r $(REPOSITORY) dist/* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/README.md new/django-webpack-loader-0.7.0/README.md --- old/django-webpack-loader-0.6.0/README.md 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/README.md 2020-01-13 21:57:18.000000000 +0100 @@ -1,7 +1,7 @@ # django-webpack-loader [![Join the chat at https://gitter.im/owais/django-webpack-loader](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/owais/django-webpack-loader?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Build Status](https://travis-ci.org/owais/django-webpack-loader.svg?branch=master)](https://travis-ci.org/owais/django-webpack-loader) +[![Build Status](https://circleci.com/gh/owais/django-webpack-loader/tree/master.svg?style=svg)](https://circleci.com/gh/owais/django-webpack-loader/tree/master) [![Coverage Status](https://coveralls.io/repos/owais/django-webpack-loader/badge.svg?branch=master&service=github)](https://coveralls.io/github/owais/django-webpack-loader?branch=master) <br> @@ -16,18 +16,10 @@ A [changelog](CHANGELOG.md) is also available. -## Maintainers -In order to overcome the lack of support for Markdown on PyPi, building this package can use [pandoc](http://pandoc.org/installing.html) along with [pypandoc](https://pypi.python.org/pypi/pypandoc) to convert the README.md into a Restructured Text format compatible with PyPI. This requires installing `pandoc` for your operating system (installation instructions on the pandoc site), and `pypandoc` which will be installed if you: - - pip install -r requirements-dev.txt - -before uploading to PyPI. - -If pandoc or pypandoc fails, the README.md file will be uploaded as it was before this enhancement. ## Compatibility -Test cases cover Django>=1.6 on Python 2.7 and Python>=3.3. 100% code coverage is the target so we can be sure everything works anytime. It should probably work on older version of django as well but the package does not ship any test cases for them. +Test cases cover Django>=1.6 on Python 2.7 and Python>=3.4. 100% code coverage is the target so we can be sure everything works anytime. It should probably work on older version of django as well but the package does not ship any test cases for them. ## Install @@ -98,7 +90,8 @@ 'STATS_FILE': os.path.join(BASE_DIR, 'webpack-stats.json'), 'POLL_INTERVAL': 0.1, 'TIMEOUT': None, - 'IGNORE': ['.+\.hot-update.js', '.+\.map'] + 'IGNORE': [r'.+\.hot-update.js', r'.+\.map'], + 'LOADER_CLASS': 'webpack_loader.loader.WebpackLoader', } } ``` @@ -126,7 +119,7 @@ } ``` -`BUNDLE_DIR_NAME` refers to the dir in which webpack outputs the bundles. It should not be the full path. If `./assets` is one of you static dirs and webpack generates the bundles in `./assets/output/bundles/`, then `BUNDLE_DIR_NAME` should be `output/bundles/`. +`BUNDLE_DIR_NAME` refers to the dir in which webpack outputs the bundles. It should not be the full path. If `./assets` is one of your static dirs and webpack generates the bundles in `./assets/output/bundles/`, then `BUNDLE_DIR_NAME` should be `output/bundles/`. If the bundle generates a file called `main-cf4b5fab6e00a404e0c7.js` and your STATIC_URL is `/static/`, then the `<script>` tag will look like this @@ -134,6 +127,8 @@ <script type="text/javascript" src="/static/output/bundles/main-cf4b5fab6e00a404e0c7.js"/> ``` +**NOTE:** If your webpack config outputs the bundles at the root of your `staticfiles` dir, then `BUNDLE_DIR_NAME` should be an empty string `''`, not `'/'`. + <br> #### STATS_FILE @@ -174,6 +169,40 @@ <br> +#### LOADER_CLASS + +`LOADER_CLASS` is the fully qualified name of a python class as a string that holds the custom webpack loader. +This is where behavior can be customized as to how the stats file is loaded. Examples include loading the stats file +from a database, cache, external url, etc. For convenience, `webpack_loader.loader.WebpackLoader` can be extended; +The `load_assets` method is likely where custom behavior will be added. This should return the stats file as an object. + +Here's a simple example of loading from an external url: + +```py +# in app.module +import requests +from webpack_loader.loader import WebpackLoader + +class ExternalWebpackLoader(WebpackLoader): + + def load_assets(self): + url = self.config['STATS_URL'] + return requests.get(url).json() + + +# in app.settings +WEBPACK_LOADER = { + 'DEFAULT': { + 'CACHE': False, + 'BUNDLE_DIR_NAME': 'bundles/', + 'LOADER_CLASS': 'app.module.ExternalWebpackLoader', + # Custom config setting made available in WebpackLoader's self.config + 'STATS_URL': 'https://www.test.com/path/to/stats/', + } +} +``` + +<br> ## Usage <br> @@ -258,7 +287,7 @@ {% render_bundle 'main' config='DASHBOARD' extension='css' %} <!-- add some extra attributes to the tag --> - {% render_bundle 'main' 'js' 'DEFAULT' attrs='async chatset="UTF-8"'%} + {% render_bundle 'main' 'js' 'DEFAULT' attrs='async charset="UTF-8"'%} </body> </head> ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/examples/simple/app/urls.py new/django-webpack-loader-0.7.0/examples/simple/app/urls.py --- old/django-webpack-loader-0.6.0/examples/simple/app/urls.py 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/examples/simple/app/urls.py 2020-01-13 21:57:18.000000000 +0100 @@ -16,10 +16,10 @@ from django.conf.urls import include, url from django.contrib import admin from django.views.generic import TemplateView - - +## For Django 2+ support +from django.urls import path urlpatterns = [ url(r'^$', TemplateView.as_view(template_name='home.html'), name='home'), - url(r'^admin/', include(admin.site.urls)), + path('admin/', admin.site.urls), ## Django 2+ admin namespace ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/requirements-dev.txt new/django-webpack-loader-0.7.0/requirements-dev.txt --- old/django-webpack-loader-0.6.0/requirements-dev.txt 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/requirements-dev.txt 2020-01-13 21:57:18.000000000 +0100 @@ -3,3 +3,4 @@ django-jinja==2.2.1 django-jinja2==0.1 unittest2==1.1.0 +wheel==0.30.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/setup.py new/django-webpack-loader-0.7.0/setup.py --- old/django-webpack-loader-0.6.0/setup.py 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/setup.py 2020-01-13 21:57:18.000000000 +0100 @@ -8,10 +8,7 @@ '''returns the relative path to a file wrt to the current directory''' return os.path.abspath(os.path.join(os.path.dirname(__file__), *parts)) -if os.path.isfile('README.rst'): - README = open('README.rst', 'r').read() -else: - README = open('README.md', 'r').read() +README = open('README.md', 'r').read() with open(rel('webpack_loader', '__init__.py')) as handler: INIT_PY = handler.read() @@ -25,6 +22,7 @@ version = VERSION, description = 'Transparently use webpack with django', long_description=README, + long_description_content_type="text/markdown", author = 'Owais Lone', author_email = 'he...@owaislone.org', download_url = 'https://github.com/owais/django-webpack-loader/tarball/{0}'.format(VERSION), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/tests/app/tests/test_custom_loaders.py new/django-webpack-loader-0.7.0/tests/app/tests/test_custom_loaders.py --- old/django-webpack-loader-0.6.0/tests/app/tests/test_custom_loaders.py 1970-01-01 01:00:00.000000000 +0100 +++ new/django-webpack-loader-0.7.0/tests/app/tests/test_custom_loaders.py 2020-01-13 21:57:18.000000000 +0100 @@ -0,0 +1,63 @@ +from imp import reload +from django.test import TestCase +from webpack_loader import utils, config, loader + + +DEFAULT_CONFIG = 'DEFAULT' +LOADER_PAYLOAD = {'status': 'done', 'chunks': []} + + +class ValidCustomLoader(loader.WebpackLoader): + + def load_assets(self): + return LOADER_PAYLOAD + + +class CustomLoadersTestCase(TestCase): + def tearDown(self): + self.reload_webpack() + + def reload_webpack(self): + ''' + Reloads webpack loader modules that have cached values to avoid polluting certain tests + ''' + reload(utils) + reload(config) + + def test_bad_custom_loader(self): + ''' + Tests that a bad custom loader path will raise an error + ''' + loader_class = 'app.tests.bad_loader_path.BadCustomLoader' + with self.settings(WEBPACK_LOADER={ + 'DEFAULT': { + 'CACHE': False, + 'BUNDLE_DIR_NAME': 'bundles/', + 'LOADER_CLASS': loader_class + } + }): + self.reload_webpack() + try: + loader = utils.get_loader(DEFAULT_CONFIG) + self.fail('The loader should fail to load with a bad LOADER_CLASS') + except ImportError as e: + self.assertIn( + '{} doesn\'t look like a valid module path'.format(loader_class), + str(e) + ) + + def test_good_custom_loader(self): + ''' + Tests that a good custom loader will return the correct assets + ''' + loader_class = 'app.tests.test_custom_loaders.ValidCustomLoader' + with self.settings(WEBPACK_LOADER={ + 'DEFAULT': { + 'CACHE': False, + 'BUNDLE_DIR_NAME': 'bundles/', + 'LOADER_CLASS': loader_class, + } + }): + self.reload_webpack() + assets = utils.get_loader(DEFAULT_CONFIG).load_assets() + self.assertEqual(assets, LOADER_PAYLOAD) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/tests/app/tests/test_webpack.py new/django-webpack-loader-0.7.0/tests/app/tests/test_webpack.py --- old/django-webpack-loader-0.6.0/tests/app/tests/test_webpack.py 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/tests/app/tests/test_webpack.py 2020-01-13 21:57:18.000000000 +0100 @@ -235,7 +235,7 @@ elapsed = time.time() - then t.join() t2.join() - self.assertTrue(elapsed > wait_for) + self.assertTrue(elapsed >= wait_for) with self.settings(DEBUG=False): self.compile_bundles('webpack.config.simple.js') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/tests/requirements/common.txt new/django-webpack-loader-0.7.0/tests/requirements/common.txt --- old/django-webpack-loader-0.6.0/tests/requirements/common.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/django-webpack-loader-0.7.0/tests/requirements/common.txt 2020-01-13 21:57:18.000000000 +0100 @@ -0,0 +1,3 @@ +coverage>=4.5.4 +coveralls>=1.10.0 +unittest2>=1.1.0 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/tests/requirements/django110.txt new/django-webpack-loader-0.7.0/tests/requirements/django110.txt --- old/django-webpack-loader-0.6.0/tests/requirements/django110.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/django-webpack-loader-0.7.0/tests/requirements/django110.txt 2020-01-13 21:57:18.000000000 +0100 @@ -0,0 +1,2 @@ +django>=1.10,<1.11 +django_jinja>=2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/tests/requirements/django111.txt new/django-webpack-loader-0.7.0/tests/requirements/django111.txt --- old/django-webpack-loader-0.6.0/tests/requirements/django111.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/django-webpack-loader-0.7.0/tests/requirements/django111.txt 2020-01-13 21:57:18.000000000 +0100 @@ -0,0 +1,2 @@ +django>=1.11,<1.12 +django_jinja>=2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/tests/requirements/django18.txt new/django-webpack-loader-0.7.0/tests/requirements/django18.txt --- old/django-webpack-loader-0.6.0/tests/requirements/django18.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/django-webpack-loader-0.7.0/tests/requirements/django18.txt 2020-01-13 21:57:18.000000000 +0100 @@ -0,0 +1,2 @@ +django>=1.8,<1.9.0 +django_jinja>=2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/tests/requirements/django19.txt new/django-webpack-loader-0.7.0/tests/requirements/django19.txt --- old/django-webpack-loader-0.6.0/tests/requirements/django19.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/django-webpack-loader-0.7.0/tests/requirements/django19.txt 2020-01-13 21:57:18.000000000 +0100 @@ -0,0 +1,2 @@ +django>=1.9,<1.10 +django_jinja>=2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/tests/tox.ini new/django-webpack-loader-0.7.0/tests/tox.ini --- old/django-webpack-loader-0.6.0/tests/tox.ini 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/tests/tox.ini 2020-01-13 21:57:18.000000000 +0100 @@ -2,16 +2,12 @@ minversion = 1.6 skipsdist = True envlist = - py26-django16 - py27-django{16,17,18,19,110,111} py33-django{17,18} py34-django{17,18,19,110,111} py35-django{18,19,110,111} [testenv] basepython = - py26: python2.6 - py27: python2.7 py33: python3.3 py34: python3.4 py35: python3.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/webpack_loader/__init__.py new/django-webpack-loader-0.7.0/webpack_loader/__init__.py --- old/django-webpack-loader-0.6.0/webpack_loader/__init__.py 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/webpack_loader/__init__.py 2020-01-13 21:57:18.000000000 +0100 @@ -1,4 +1,4 @@ __author__ = 'Owais Lone' -__version__ = '0.6.0' +__version__ = '0.7.0' default_app_config = 'webpack_loader.apps.WebpackLoaderConfig' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/webpack_loader/config.py new/django-webpack-loader-0.7.0/webpack_loader/config.py --- old/django-webpack-loader-0.6.0/webpack_loader/config.py 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/webpack_loader/config.py 2020-01-13 21:57:18.000000000 +0100 @@ -14,7 +14,8 @@ # FIXME: Explore usage of fsnotify 'POLL_INTERVAL': 0.1, 'TIMEOUT': None, - 'IGNORE': ['.+\.hot-update.js', '.+\.map'] + 'IGNORE': ['.+\.hot-update.js', '.+\.map'], + 'LOADER_CLASS': 'webpack_loader.loader.WebpackLoader', } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/webpack_loader/loader.py new/django-webpack-loader-0.7.0/webpack_loader/loader.py --- old/django-webpack-loader-0.6.0/webpack_loader/loader.py 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/webpack_loader/loader.py 2020-01-13 21:57:18.000000000 +0100 @@ -11,17 +11,16 @@ WebpackLoaderTimeoutError, WebpackBundleLookupError ) -from .config import load_config class WebpackLoader(object): _assets = {} - def __init__(self, name='DEFAULT'): + def __init__(self, name, config): self.name = name - self.config = load_config(self.name) + self.config = config - def _load_assets(self): + def load_assets(self): try: with open(self.config['STATS_FILE'], encoding="utf-8") as f: return json.load(f) @@ -34,9 +33,9 @@ def get_assets(self): if self.config['CACHE']: if self.name not in self._assets: - self._assets[self.name] = self._load_assets() + self._assets[self.name] = self.load_assets() return self._assets[self.name] - return self._load_assets() + return self.load_assets() def filter_chunks(self, chunks): for chunk in chunks: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/django-webpack-loader-0.6.0/webpack_loader/utils.py new/django-webpack-loader-0.7.0/webpack_loader/utils.py --- old/django-webpack-loader-0.6.0/webpack_loader/utils.py 2018-02-23 06:09:05.000000000 +0100 +++ new/django-webpack-loader-0.7.0/webpack_loader/utils.py 2020-01-13 21:57:18.000000000 +0100 @@ -1,14 +1,31 @@ +from importlib import import_module from django.conf import settings - -from .loader import WebpackLoader +from .config import load_config _loaders = {} +def import_string(dotted_path): + ''' + This is a rough copy of django's import_string, which wasn't introduced until Django 1.7 + + Once this package's support for Django 1.6 has been removed, this can be safely replaced with + `from django.utils.module_loading import import_string` + ''' + try: + module_path, class_name = dotted_path.rsplit('.', 1) + module = import_module(module_path) + return getattr(module, class_name) + except (ValueError, AttributeError, ImportError): + raise ImportError('%s doesn\'t look like a valid module path' % dotted_path) + + def get_loader(config_name): if config_name not in _loaders: - _loaders[config_name] = WebpackLoader(config_name) + config = load_config(config_name) + loader_class = import_string(config['LOADER_CLASS']) + _loaders[config_name] = loader_class(config_name, config) return _loaders[config_name]