Skip to content

Commit 07cfee8

Browse files
author
Buky
authored
Merge pull request #718 from jazzband/dropping-python2-support
Dropping python2 support
2 parents 2a942cd + eed4981 commit 07cfee8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+70
-219
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ tests/node_modules/
1818
.DS_Store
1919
.idea
2020
.venv
21+
.vscode
2122
.project
2223
.pydevproject
2324
.ropeproject

.travis.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,16 @@ sudo: True
33
dist: xenial
44
matrix:
55
include:
6-
- env: TOXENV=py27-django111
7-
python: "2.7"
8-
- env: TOXENV=pypy-django111
9-
python: "pypy"
10-
- env: TOXENV=py35-django111
11-
python: "3.5"
12-
- env: TOXENV=py36-django111
13-
python: "3.6"
14-
- env: TOXENV=py36-django20
15-
python: "3.6"
16-
- env: TOXENV=py35-django22
17-
python: "3.5"
6+
- env: TOXENV=pypy3-django22
7+
python: "pypy3"
188
- env: TOXENV=py36-django22
199
python: "3.6"
2010
- env: TOXENV=py37-django22
2111
python: "3.7"
12+
- env: TOXENV=py38-django22
13+
python: "3.8"
14+
- env: TOXENV=pypy3-django30
15+
python: "pypy3"
2216
- env: TOXENV=py36-django30
2317
python: "3.6"
2418
- env: TOXENV=py37-django30
@@ -32,7 +26,7 @@ matrix:
3226
- env: TOXENV=py38-django-master
3327
python: "3.8-dev"
3428
- env: TOXENV=docs
35-
python: "2.7"
29+
python: "3.6"
3630
allow_failures:
3731
- env: TOXENV=py36-django-master
3832
- env: TOXENV=py37-django-master
@@ -54,6 +48,6 @@ deploy:
5448
on:
5549
tags: true
5650
repo: jazzband/django-pipeline
57-
condition: "$TOXENV = py27-django111"
51+
condition: "$TOXENV = py36-django30"
5852
notifications:
5953
email: false

HISTORY.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@
33
History
44
=======
55

6+
2.0.0
7+
=====
8+
9+
* **Definitely drop the support of Python 2**.
10+
* Drop support for Python 3.5 (not compatible with PEP 498).
11+
* Remove 'decorator.py' how was used for backward compatibility
12+
between python 2 and 3 for metaclass inheritance on PipelineFormMedia.
13+
* Replace 'format' by 'fstring' (PEP 498: Literal String Interpolation).
14+
* Remove of old imports form 'django.utils.six' and these fixes (1.7.0).
15+
* Remove tests of uncovered versions of Python and Django.
16+
* Replace tests for Pypy by Pypy3.
17+
* Explicitly specify when files are read / write in binary mode.
18+
* Set opening files for tests to deal with universal newlines.
19+
* Upgrade documentation version to 2.0 to follow the project version.
20+
621
1.7.0
722
=====
823

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@
4949
# built documents.
5050
#
5151
# The short X.Y version.
52-
version = '1.6'
52+
version = '2.0'
5353
# The full version, including alpha/beta/rc tags.
54-
release = '1.6.14'
54+
release = '2.0.0'
5555

5656
# The language for content autogenerated by Sphinx. Refer to documentation
5757
# for a list of supported languages.

pipeline/collector.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
from __future__ import unicode_literals
2-
31
import os
42

53
from collections import OrderedDict
64

75
import django
86
from django.contrib.staticfiles import finders
97
from django.contrib.staticfiles.storage import staticfiles_storage
10-
try:
11-
from django.utils.six import iterkeys
12-
except ImportError:
13-
iterkeys = iter
14-
158

169
from pipeline.finders import PipelineFinder
1710

@@ -61,7 +54,7 @@ def collect(self, request=None, files=[]):
6154
if files and len(files) == len(found_files):
6255
break
6356

64-
return iterkeys(found_files)
57+
return found_files.keys()
6558

6659
def copy_file(self, path, prefixed_path, source_storage):
6760
# Delete the target file if needed or break

pipeline/compilers/__init__.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
import os
42
import shutil
53
import subprocess
@@ -8,12 +6,6 @@
86
from django.contrib.staticfiles import finders
97
from django.contrib.staticfiles.storage import staticfiles_storage
108
from django.core.files.base import ContentFile
11-
from django.utils.encoding import smart_bytes
12-
try:
13-
from django.utils.six import string_types, text_type
14-
except ImportError:
15-
string_types = (str,)
16-
text_type = str
179

1810
from pipeline.conf import settings
1911
from pipeline.exceptions import CompilerError
@@ -73,7 +65,7 @@ def compile_file(self, infile, outfile, outdated=False, force=False):
7365
raise NotImplementedError
7466

7567
def save_file(self, path, content):
76-
return self.storage.save(path, ContentFile(smart_bytes(content)))
68+
return self.storage.save(path, ContentFile(content))
7769

7870
def read_file(self, path):
7971
file = self.storage.open(path, 'rb')
@@ -114,7 +106,7 @@ def execute_command(self, command, cwd=None, stdout_captured=None):
114106
"""
115107
argument_list = []
116108
for flattening_arg in command:
117-
if isinstance(flattening_arg, string_types):
109+
if isinstance(flattening_arg, (str,)):
118110
argument_list.append(flattening_arg)
119111
else:
120112
argument_list.extend(flattening_arg)
@@ -126,7 +118,7 @@ def execute_command(self, command, cwd=None, stdout_captured=None):
126118
try:
127119
# We always catch stdout in a file, but we may not have a use for it.
128120
temp_file_container = cwd or os.path.dirname(stdout_captured or "") or os.getcwd()
129-
with NamedTemporaryFile(delete=False, dir=temp_file_container) as stdout:
121+
with NamedTemporaryFile('wb', delete=False, dir=temp_file_container) as stdout:
130122
compiling = subprocess.Popen(argument_list, cwd=cwd,
131123
stdout=stdout,
132124
stderr=subprocess.PIPE)
@@ -136,19 +128,19 @@ def execute_command(self, command, cwd=None, stdout_captured=None):
136128
if compiling.returncode != 0:
137129
stdout_captured = None # Don't save erroneous result.
138130
raise CompilerError(
139-
"{0!r} exit code {1}\n{2}".format(argument_list, compiling.returncode, stderr),
131+
f"{argument_list!r} exit code {compiling.returncode}\n{stderr}",
140132
command=argument_list,
141133
error_output=stderr)
142134

143135
# User wants to see everything that happened.
144136
if self.verbose:
145-
with open(stdout.name) as out:
137+
with open(stdout.name, 'rb') as out:
146138
print(out.read())
147139
print(stderr)
148140
except OSError as e:
149141
stdout_captured = None # Don't save erroneous result.
150142
raise CompilerError(e, command=argument_list,
151-
error_output=text_type(e))
143+
error_output=str(e))
152144
finally:
153145
# Decide what to do with captured stdout.
154146
if stdout:

pipeline/compilers/coffee.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
from pipeline.conf import settings
42
from pipeline.compilers import SubProcessCompiler
53

pipeline/compilers/es6.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
from pipeline.conf import settings
42
from pipeline.compilers import SubProcessCompiler
53

pipeline/compilers/less.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
from os.path import dirname
42

53
from pipeline.conf import settings

pipeline/compilers/livescript.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
from pipeline.conf import settings
42
from pipeline.compilers import SubProcessCompiler
53

0 commit comments

Comments
 (0)