From 510a53019e3c53188c1c062f75a378995a7c38f2 Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Sun, 8 Dec 2019 08:15:50 +0500 Subject: [PATCH 1/2] Django 2.2 support --- .travis.yml | 10 ++++++++++ setup.py | 2 +- tox.ini | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 487f6fb..cfe7306 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ env: - DJANGO_VERSION=1.9.x - DJANGO_VERSION=1.10.x - DJANGO_VERSION=1.11.x + - DJANGO_VERSION=2.2.x install: - pip install tox script: @@ -21,3 +22,12 @@ matrix: env: DJANGO_VERSION=master - python: "pypy" env: DJANGO_VERSION=master + - python: "2.7" + env: DJANGO_VERSION=2.2.x + - python: "3.4" + env: DJANGO_VERSION=2.2.x + - python: "pypy" + env: DJANGO_VERSION=2.2.x + include: + - python: "3.5" + env: DJANGO_VERSION=2.2.x diff --git a/setup.py b/setup.py index 5805f02..227e6f9 100755 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ def read(*parts): install_requires = [ - 'django>=1.8,<2.0', + 'django>=1.8,<=2.2', 'babel>=1.3', 'django-babel>=0.5.1', 'markey>=0.8,<0.9', diff --git a/tox.ini b/tox.ini index eb837e8..10b35c7 100644 --- a/tox.ini +++ b/tox.ini @@ -14,6 +14,8 @@ deps110 = https://github.com/django/django/archive/stable/1.10.x.tar.gz#egg=django deps111 = https://github.com/django/django/archive/stable/1.11.x.tar.gz#egg=django +deps22 = + https://github.com/django/django/archive/stable/2.2.x.tar.gz#egg=django master = https://github.com/django/django/archive/master.tar.gz#egg=django @@ -69,6 +71,10 @@ deps = {[testenv]deps110} basepython = python3.5 deps = {[testenv]deps111} +[testenv:3.5-2.2.x] +basepython = python3.5 +deps = {[testenv]deps22} + [testenv:3.5-master] basepython = python3.5 deps = {[testenv]master} @@ -89,6 +95,10 @@ deps = {[testenv]deps110} basepython = pypy deps = {[testenv]deps111} +[testenv:pypy-2.2.x] +basepython = pypy +deps = {[testenv]deps22} + [docs] commands = pip install -e {toxinidir} From 47ff598094c9aa7dc2badd2862fab166d76b76e2 Mon Sep 17 00:00:00 2001 From: muhammad-ammar Date: Sat, 14 Dec 2019 07:04:10 +0500 Subject: [PATCH 2/2] more --- .travis.yml | 11 ++++++----- setup.py | 3 +++ src/django_babel_underscore/__init__.py | 9 ++++++--- tox.ini | 4 ---- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index cfe7306..91c37e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,14 +20,15 @@ matrix: exclude: - python: "2.7" env: DJANGO_VERSION=master - - python: "pypy" - env: DJANGO_VERSION=master - python: "2.7" env: DJANGO_VERSION=2.2.x + - python: "3.4" + env: DJANGO_VERSION=master - python: "3.4" env: DJANGO_VERSION=2.2.x - - python: "pypy" - env: DJANGO_VERSION=2.2.x - include: - python: "3.5" + env: DJANGO_VERSION=master + - python: "pypy" env: DJANGO_VERSION=2.2.x + - python: "pypy" + env: DJANGO_VERSION=master diff --git a/setup.py b/setup.py index 227e6f9..8c4de98 100755 --- a/setup.py +++ b/setup.py @@ -83,5 +83,8 @@ def read(*parts): 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', ], ) diff --git a/src/django_babel_underscore/__init__.py b/src/django_babel_underscore/__init__.py index 6cd5bd7..e4ae7b4 100755 --- a/src/django_babel_underscore/__init__.py +++ b/src/django_babel_underscore/__init__.py @@ -1,10 +1,13 @@ # -*- coding: utf-8 -*- import django -if django.VERSION[:2] >= (1, 8): - from django.template.base import Lexer, TOKEN_TEXT +from django.template.base import Lexer +try: + from django.template.base import TokenType +except ImportError: # django < 2.1 + from django.template.base import TOKEN_TEXT else: - from django.template import Lexer, TOKEN_TEXT + TOKEN_TEXT = TokenType.TEXT from django.utils.encoding import force_text from django_babel.extract import extract_django diff --git a/tox.ini b/tox.ini index 10b35c7..4bae3f9 100644 --- a/tox.ini +++ b/tox.ini @@ -95,10 +95,6 @@ deps = {[testenv]deps110} basepython = pypy deps = {[testenv]deps111} -[testenv:pypy-2.2.x] -basepython = pypy -deps = {[testenv]deps22} - [docs] commands = pip install -e {toxinidir}