Skip to content

Commit 27f461f

Browse files
TheBukyTheBuky
authored andcommitted
Permanently remove dependencies used for Python 2
We don't need anymore 'future' imports. Explicitly said with which mode is open a file. Replace smart_bytes by a methode how simulate file reading in tests. Respect the universal newlines '\r\n' instead of '\n'.
1 parent e0eed13 commit 27f461f

Some content is hidden

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

48 files changed

+70
-160
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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ matrix:
55
include:
66
- env: TOXENV=pypy3-django22
77
python: "pypy3"
8-
- env: TOXENV=py35-django22
9-
python: "3.5"
108
- env: TOXENV=py36-django22
119
python: "3.6"
1210
- env: TOXENV=py37-django22
1311
python: "3.7"
1412
- env: TOXENV=py38-django22
1513
python: "3.8"
14+
- env: TOXENV=pypy3-django30
15+
python: "pypy3"
1616
- env: TOXENV=py36-django30
1717
python: "3.6"
1818
- env: TOXENV=py37-django30
@@ -48,6 +48,6 @@ deploy:
4848
on:
4949
tags: true
5050
repo: jazzband/django-pipeline
51-
condition: "$TOXENV = py36-django22"
51+
condition: "$TOXENV = py36-django30"
5252
notifications:
5353
email: false

HISTORY.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@
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 / writ in binary mode.
18+
* Deal with universal newlines of Python 3 for tests. When opening a file
19+
as binary mode '\r\n' is used as linebreak instead of '\n'. Open file in
20+
text mode for tests to let OS correctly interpret line breaks and remove
21+
'smart_bytes' not anymore used.
22+
* Add method to simulate file reading for tests to correctly interpret
23+
line breaks from given string.
24+
* Upgrade documentation version to 2.0.
25+
626
1.7.0
727
=====
828

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: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import unicode_literals
2-
31
import os
42

53
from collections import OrderedDict

pipeline/compilers/__init__.py

Lines changed: 4 additions & 7 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,7 +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
129

1310
from pipeline.conf import settings
1411
from pipeline.exceptions import CompilerError
@@ -68,7 +65,7 @@ def compile_file(self, infile, outfile, outdated=False, force=False):
6865
raise NotImplementedError
6966

7067
def save_file(self, path, content):
71-
return self.storage.save(path, ContentFile(smart_bytes(content)))
68+
return self.storage.save(path, ContentFile(content))
7269

7370
def read_file(self, path):
7471
file = self.storage.open(path, 'rb')
@@ -121,7 +118,7 @@ def execute_command(self, command, cwd=None, stdout_captured=None):
121118
try:
122119
# We always catch stdout in a file, but we may not have a use for it.
123120
temp_file_container = cwd or os.path.dirname(stdout_captured or "") or os.getcwd()
124-
with NamedTemporaryFile(delete=False, dir=temp_file_container) as stdout:
121+
with NamedTemporaryFile('wb', delete=False, dir=temp_file_container) as stdout:
125122
compiling = subprocess.Popen(argument_list, cwd=cwd,
126123
stdout=stdout,
127124
stderr=subprocess.PIPE)
@@ -131,13 +128,13 @@ def execute_command(self, command, cwd=None, stdout_captured=None):
131128
if compiling.returncode != 0:
132129
stdout_captured = None # Don't save erroneous result.
133130
raise CompilerError(
134-
"{0!r} exit code {1}\n{2}".format(argument_list, compiling.returncode, stderr),
131+
f"{argument_list!r} exit code {compiling.returncode}\n{stderr}",
135132
command=argument_list,
136133
error_output=stderr)
137134

138135
# User wants to see everything that happened.
139136
if self.verbose:
140-
with open(stdout.name) as out:
137+
with open(stdout.name, 'rb') as out:
141138
print(out.read())
142139
print(stderr)
143140
except OSError as e:

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)