Skip to content

Commit

Permalink
Drop older versions of Django (2.2, 3.1) & Python (3.7) (django-compr…
Browse files Browse the repository at this point in the history
  • Loading branch information
diox authored Oct 31, 2022
1 parent c9b7586 commit 8a0b706
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 100 deletions.
20 changes: 2 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,6 @@ jobs:
fail-fast: false
matrix:
versions:
- python: 3.7
toxenv: py37-2.2.X
- python: 3.8
toxenv: py38-2.2.X
- python: 3.9
toxenv: py39-2.2.X

- python: 3.7
toxenv: py37-3.1.X
- python: 3.8
toxenv: py38-3.1.X
- python: 3.9
toxenv: py39-3.1.X

- python: 3.7
toxenv: py37-3.2.X
- python: 3.8
toxenv: py38-3.2.X
- python: 3.9
Expand All @@ -52,8 +36,8 @@ jobs:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.versions.python }}
- run: |
Expand Down
18 changes: 0 additions & 18 deletions compressor/filters/jsmin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warnings

from django.core.exceptions import ImproperlyConfigured

from compressor.filters import FilterBase, CallbackOutputFilter
Expand All @@ -15,22 +13,6 @@ class rJSMinFilter(CallbackOutputFilter):
JSMinFilter = rJSMinFilter


class SlimItFilter(CallbackOutputFilter):
dependencies = ["slimit"]
callback = "slimit.minify"
kwargs = {
"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):
try:
Expand Down
13 changes: 2 additions & 11 deletions compressor/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import sys
from collections import defaultdict
from unittest import mock, skipIf
from unittest import mock

from django.conf import settings
from django.test import override_settings, TestCase
Expand All @@ -15,7 +15,7 @@
from compressor.filters.closure import ClosureCompilerFilter
from compressor.filters.css_default import CssAbsoluteFilter, CssRelativeFilter
from compressor.filters.cssmin import CSSCompressorFilter, rCSSMinFilter
from compressor.filters.jsmin import CalmjsFilter, rJSMinFilter, SlimItFilter
from compressor.filters.jsmin import CalmjsFilter, rJSMinFilter
from compressor.filters.template import TemplateFilter
from compressor.filters.yuglify import YUglifyCSSFilter, YUglifyJSFilter
from compressor.filters.yui import YUICSSFilter, YUIJSFilter
Expand Down Expand Up @@ -247,15 +247,6 @@ def test_jsmin_filter(self):
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 = """
var foo = "bar";"""
output = """var foo="bar";"""
self.assertEqual(output, SlimItFilter(content).output())


class CalmjsTestCase(TestCase):
def test_calmjs_filter(self):
content = """
Expand Down
4 changes: 3 additions & 1 deletion docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changelog
Unreleased
----------

- Drop Python 3.6 support
- Drop Python 3.6 and 3.7 support
- Drop Django 2.2 and 3.1 support
- Drop SlimItFilter
- Update the `CachedS3Boto3Storage` example storage subclass in "Remote Storages"
to work properly after the v4.0 change to how duplicate file names are handled
by `CompressorFileStorage`
Expand Down
105 changes: 59 additions & 46 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ def __init__(self):
self.version = None

def visit_Assign(self, node):
if node.targets[0].id == '__version__':
if node.targets[0].id == "__version__":
self.version = node.value.s


def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()


Expand All @@ -31,21 +31,31 @@ def find_version(*parts):

# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*$py.class', '*~', '.*', '*.bak')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')
standard_exclude = ("*.py", "*.pyc", "*$py.class", "*~", ".*", "*.bak")
standard_exclude_directories = (
".*",
"CVS",
"_darcs",
"./build",
"./dist",
"EGG-INFO",
"*.egg-info",
)


# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# Note: you may want to copy this into your setup.py file verbatim, as
# you can't import this from another package, when you don't know if
# that package is installed yet.
def find_package_data(where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
def find_package_data(
where=".",
package="",
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False,
):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
Expand Down Expand Up @@ -74,81 +84,84 @@ def find_package_data(where='.', package='',
"""

out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
stack = [(convert_path(where), "", package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print("Directory %s ignored by pattern %s" %
(fn, pattern), file=sys.stderr)
print(
"Directory %s ignored by pattern %s" % (fn, pattern),
file=sys.stderr,
)
break
if bad_name:
continue
if (os.path.isfile(os.path.join(fn, '__init__.py')) and not prefix):
if os.path.isfile(os.path.join(fn, "__init__.py")) and not prefix:
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
new_package = package + "." + name
stack.append((fn, "", new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
stack.append((fn, prefix + name + "/", package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
if fnmatchcase(name, pattern) or fn.lower() == pattern.lower():
bad_name = True
if show_ignored:
print("File %s ignored by pattern %s" %
(fn, pattern), file=sys.stderr)
print(
"File %s ignored by pattern %s" % (fn, pattern),
file=sys.stderr,
)
break
if bad_name:
continue
out.setdefault(package, []).append(prefix + name)
return out


setup(
name="django_compressor",
version=find_version("compressor", "__init__.py"),
url='https://django-compressor.readthedocs.io/en/latest/',
url="https://django-compressor.readthedocs.io/en/latest/",
project_urls={
'Source': 'https://github.com/django-compressor/django-compressor',
"Source": "https://github.com/django-compressor/django-compressor",
},
license='MIT',
license="MIT",
description="Compresses linked and inline JavaScript or CSS into single cached files.",
long_description=read('README.rst'),
author='Jannis Leidel',
author_email='jannis@leidel.info',
long_description=read("README.rst"),
author="Jannis Leidel",
author_email="jannis@leidel.info",
packages=find_packages(),
package_data=find_package_data(),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.1',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.0',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Internet :: WWW/HTTP',
"Development Status :: 5 - Production/Stable",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Django :: 4.1",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Internet :: WWW/HTTP",
],
zip_safe=False,
install_requires=[
'django-appconf >= 1.0.3',
'rcssmin == 1.1.1',
'rjsmin == 1.2.0',
"django-appconf >= 1.0.3",
"rcssmin == 1.1.1",
"rjsmin == 1.2.1",
],
)
7 changes: 1 addition & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[tox]
envlist =
{py37,py38,py39}-2.2.X
{py37,py38,py39}-3.1.X
{py37,py38,py39,py310}-3.2.X
{py38,py39,py310}-3.2.X
{py38,py39,py310}-4.0.X
{py38,py39,py310}-4.1.X
[testenv]
basepython =
py37: python3.7
py38: python3.8
py39: python3.9
py310: python3.10
Expand All @@ -19,8 +16,6 @@ commands =
django-admin --version
make test
deps =
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.0,<4.1
4.1.X: Django>=4.1,<4.2
Expand Down

0 comments on commit 8a0b706

Please sign in to comment.