Skip to content

Commit 366ac36

Browse files
Merge pull request #171 from presidento/django52
Ensure Django 5.2 and Python 3.13 support
2 parents 4f607bb + 9d04fed commit 366ac36

File tree

9 files changed

+256
-256
lines changed

9 files changed

+256
-256
lines changed

Dockerfile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM andreyfedoseev/django-static-precompiler:22.04-1
22
ARG DEBIAN_FRONTEND=noninteractive
33
ENV TZ=Etc/UTC
44
RUN apt update && \
5+
apt upgrade --yes && \
6+
apt autoremove --yes && \
57
apt install software-properties-common -y && \
68
add-apt-repository ppa:deadsnakes/ppa -y && \
79
apt install -y \
@@ -15,18 +17,18 @@ RUN apt update && \
1517
python3.11-dev \
1618
python3.11-distutils \
1719
python3.12-dev \
18-
python3.12-distutils \
20+
python3.13-dev \
1921
python3-pip \
20-
sqlite3
22+
sqlite3 && \
23+
apt clean
2124
ENV POETRY_HOME=/opt/poetry VIRTUAL_ENV=/opt/venv PATH=/opt/venv/bin:/opt/poetry/bin:$PATH
2225
RUN python3 -m venv $POETRY_HOME && \
2326
$POETRY_HOME/bin/pip install --upgrade pip && \
2427
$POETRY_HOME/bin/pip install poetry && \
2528
python3 -m venv $VIRTUAL_ENV
26-
RUN mkdir /app
27-
WORKDIR /app
28-
ADD poetry.lock pyproject.toml /app/
29+
WORKDIR /opt/app
30+
ADD . /opt/app/
2931
RUN poetry install --all-extras --no-root --no-interaction && \
30-
pyright --version # this is to force pyright to install its dependencies
31-
ADD . /app/
32-
RUN poetry install --all-extras --no-interaction
32+
pyright --version && \
33+
poetry install --all-extras --no-interaction && \
34+
tox run --notest -- poetry install --all-extras

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
all:
22
docker compose build
33

4+
update-dependencies:
5+
docker compose run --rm app poetry update
6+
47
shell:
58
docker compose run --rm app /bin/bash
69

docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
version: '2'
21
services:
32
app:
43
build: .
54
entrypoint: []
65
volumes:
7-
- .:/app
6+
- .:/opt/app

poetry.lock

Lines changed: 225 additions & 232 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers = [
2121
"Programming Language :: Python :: 3.10",
2222
"Programming Language :: Python :: 3.11",
2323
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
2425
"Topic :: Internet :: WWW/HTTP"
2526
]
2627
packages = [
@@ -37,7 +38,7 @@ include = [
3738

3839
[tool.poetry.dependencies]
3940
python = "^3.8"
40-
Django = "^3.2.0"
41+
Django = ">=3.2.0"
4142
libsass = {version = "*", optional = true}
4243
watchdog = {version = "*", optional = true}
4344

@@ -50,7 +51,7 @@ pytest-mock = "~3.11.1"
5051
watchdog = "~3.0.0"
5152
coverage = "~7.3.0"
5253
tox = "~4.9.0"
53-
pyright = "^1.1.323"
54+
pyright = "==1.1.323" # Freezed temporarily, version 1.1.400 crashes
5455
django-stubs = "~4.2.3"
5556

5657
[tool.poetry.extras]

src/static_precompiler/compilers/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def get_full_source_path(self, source_path: str) -> str:
5050
return full_path
5151

5252
with contextlib.suppress(django.core.exceptions.SuspiciousOperation):
53-
full_path = finders.find(norm_source_path, all=False)
53+
full_path = finders.find(norm_source_path)
5454

5555
if full_path is None:
5656
raise ValueError(f"Can't find staticfile named: {source_path}")

src/static_precompiler/management/commands/compilestatic.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ def list_files(scanned_dirs: StrCollection) -> Iterable[str]:
3535
for dirname, _dirnames, filenames in os.walk(scanned_dir):
3636
for filename in filenames:
3737
path = os.path.join(dirname, filename)[len(scanned_dir) :]
38-
if path.startswith("/"):
39-
path = path[1:]
38+
path = path.lstrip(r"\/")
4039
yield path
4140

4241

tests/test_handlebars.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
def clean_javascript(js):
1212
"""Remove comments and all blank lines."""
13-
return "\n".join(line for line in js.split("\n") if line.strip() and not line.startswith("//"))
13+
text = "\n".join(line for line in js.split("\n") if line.strip() and not line.startswith("//"))
14+
text = text.replace("\\r\\n", "\\n")
15+
return text
1416

1517

1618
def test_is_supported():

tox.ini

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
[tox]
2+
toxworkdir = ../.tox
23
isolated_build = true
34
envlist =
4-
py38-django32,
5+
py38-django32
56
py39-django42
6-
py310-django42
7-
py311-django42
8-
py312-django42
7+
py310-django52
8+
py311-django52
9+
py312-django52
10+
py313-django52
911

1012
[testenv]
1113
allowlist_externals = poetry
1214
deps =
13-
django32: Django>=3.2,<4
14-
django42: Django>=4.2,<4.3
15-
commands_pre =
16-
poetry install --all-extras
15+
django32: Django~=3.2.0
16+
django42: Django~=4.2.0
17+
django52: Django~=5.2.0
1718
commands = poetry run pytest --cov static_precompiler --cov-report xml --cov-append

0 commit comments

Comments
 (0)