Skip to content

Commit

Permalink
Add Alpine 3.20 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoodsend committed Jun 1, 2024
1 parent 2ee086e commit 54f6cda
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ low latency package repositories.
============= ============================================
Distributions Supported versions
============= ============================================
Alpine_ 3.17-3.19, edge
Alpine_ 3.17-3.20, edge
Arch_ rolling
Debian_ 13 (pre-release)
Fedora_ 37-40, 41 (rawhide)
Expand Down
3 changes: 2 additions & 1 deletion docs/source/alpine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ implies the latest released version. ::

polycotylus alpine:3.17
polycotylus alpine:3.18
polycotylus alpine:3.19 # Default
polycotylus alpine:3.19
polycotylus alpine:3.20 # Default
polycotylus alpine:edge # Unstable branch


Expand Down
8 changes: 4 additions & 4 deletions docs/source/example-library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ when pip is trying to compile C extension whilst building the package.
.. code-block:: bash
polycotylus._docker.Error: Docker command:
$ docker run --rm --network=host --platform=linux/x86_64 -v/g/notebooks/polycotylus/examples/ubrotli/.polycotylus/alpine:/io:z -v/home/brenainn/.abuild/[email protected]:/home/user/.abuild/[email protected]:z -v/g/notebooks/polycotylus/examples/ubrotli/.polycotylus/alpine/3.19:/home/user/packages:z -t --user=1000 --ulimit nofile=1024:1048576 sha256:d9d05c5db0f32b251e94fa4996f2ab1a8526b6504b04010de9084a3e9118633f sh -ec 'abuild -f'
$ docker run --rm --network=host --platform=linux/x86_64 -v/g/notebooks/polycotylus/examples/ubrotli/.polycotylus/alpine:/io:z -v/home/brenainn/.abuild/[email protected]:/home/user/.abuild/[email protected]:z -v/g/notebooks/polycotylus/examples/ubrotli/.polycotylus/alpine/3.20:/home/user/packages:z -t --user=1000 --ulimit nofile=1024:1048576 sha256:d9d05c5db0f32b251e94fa4996f2ab1a8526b6504b04010de9084a3e9118633f sh -ec 'abuild -f'
returned an error:
>>> py3-ubrotli: Building /py3-ubrotli 0.1.0-r1 (using abuild 3.11.1-r0) started Sat, 19 Aug 2023 20:32:51 +0000
>>> py3-ubrotli: Checking sanity of /io/APKBUILD...
Expand Down Expand Up @@ -235,11 +235,11 @@ tell ``abuild`` to skip the bytecode collection stage. This is done via the
The next rebuild should carry you all the way to the end where you should get a message which looks like::

Built 1 artifact:
main: .polycotylus/alpine/3.19/x86_64/py3-ubrotli-0.1.0-r1.apk
main: .polycotylus/alpine/3.20/x86_64/py3-ubrotli-0.1.0-r1.apk

That's the location of your package! Notice that it's got that ``3.19`` version
That's the location of your package! Notice that it's got that ``3.20`` version
number and the architecture ``x86_64`` in its path. That's because the package
we built is only compatible with Alpine v3.19.x and is compiled for ``x86_64``.
we built is only compatible with Alpine v3.20.x and is compiled for ``x86_64``.
Use the following syntaxes to target other versions and architectures::

polycotylus alpine --architecture=aarch64
Expand Down
3 changes: 2 additions & 1 deletion polycotylus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def machine():

from ._exceptions import PolycotylusUsageError
from ._project import Project
from ._alpine import Alpine, Alpine317, Alpine318, Alpine319, AlpineEdge
from ._alpine import Alpine, Alpine317, Alpine318, Alpine319, Alpine320, AlpineEdge
from ._arch import Arch
from ._manjaro import Manjaro
from ._fedora import Fedora, Fedora37, Fedora38, Fedora39, Fedora40, Fedora41
Expand All @@ -20,6 +20,7 @@ def machine():
distributions["alpine:3.17"] = Alpine317
distributions["alpine:3.18"] = Alpine318
distributions["alpine:3.19"] = Alpine319
distributions["alpine:3.20"] = Alpine320
distributions["alpine:edge"] = AlpineEdge
distributions["debian:13"] = Debian13
distributions["fedora:37"] = Fedora37
Expand Down
11 changes: 8 additions & 3 deletions polycotylus/_alpine.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

class Alpine(BaseDistribution):
name = "alpine"
version = "3.19"
base_image = "alpine:3.19"
version = "3.20"
base_image = "alpine:3.20"
python_extras = {
"tkinter": ["python3-tkinter"],
"dbm.gnu": ["python3-gdbm"],
Expand Down Expand Up @@ -295,7 +295,12 @@ class Alpine318(Alpine):
base_image = "alpine:3.18"


Alpine319 = Alpine
class Alpine319(Alpine):
version = "3.19"
base_image = "alpine:3.19"


Alpine320 = Alpine


class AlpineEdge(Alpine):
Expand Down
2 changes: 1 addition & 1 deletion polycotylus/_completions/polycotylus.fish
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -l distributions alpine arch debian fedora manjaro opensuse ubuntu void
set -l alpine_variants alpine:3.17 alpine:3.18 alpine:3.19 alpine:edge
set -l alpine_variants alpine:3.17 alpine:3.18 alpine:3.19 alpine:3.20 alpine:edge
set -l debian_variants debian:13
set -l fedora_variants fedora:37 fedora:38 fedora:39 fedora:40 fedora:41
set -l ubuntu_variants ubuntu:23.04 ubuntu:23.10 ubuntu:24.04
Expand Down
31 changes: 26 additions & 5 deletions tests/test_alpine.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

from polycotylus import _docker, _exceptions, machine
from polycotylus._project import Project
from polycotylus._alpine import Alpine, Alpine317, Alpine318, AlpineEdge
from polycotylus._alpine import Alpine, Alpine317, Alpine318, Alpine319, AlpineEdge
import shared


class TestCommon(shared.Base):
cls = Alpine
package_install = "apk add"
package_install = "apk upgrade && apk add"


class TestCommon317(TestCommon):
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_dumb_text_viewer():

with self.mirror:
script = "sudo apk add py3-pip && pip show dumb_text_viewer"
assert "Name: dumb-text-viewer" in _docker.run(
assert "Name: dumb_text_viewer" in _docker.run(
installed, script, architecture=self.docker_architecture).output

assert _docker.run(installed, """
Expand Down Expand Up @@ -267,7 +267,7 @@ def test_kitchen_sink(monkeypatch):

monkeypatch.setenv("SETUPTOOLS_SCM_PRETEND_VERSION", "1.2.3")
all_apks = []
for _Alpine in (Alpine, Alpine317, Alpine318, AlpineEdge):
for _Alpine in (Alpine, Alpine317, Alpine318, Alpine319, AlpineEdge):
self = _Alpine(Project.from_root(shared.kitchen_sink))
self.generate()
assert "pywin32-ctypes" not in self.apkbuild()
Expand All @@ -290,7 +290,7 @@ def test_kitchen_sink(monkeypatch):

for apk in all_apks:
assert apk.path.exists()
assert len(set(i.path for i in all_apks)) == 11
assert len(set(i.path for i in all_apks)) == 14

assert json.loads((shared.kitchen_sink / ".polycotylus/artifacts.json").read_bytes()) == [
{
Expand Down Expand Up @@ -349,6 +349,27 @@ def test_kitchen_sink(monkeypatch):
"variant": "pyc",
"path": ".polycotylus/alpine/3.19/x86_64/py3-99---s1lly---name---packag3--x--y--z-pyc-1.2.3-r1.apk",
"signature_path": None
}, {
"distribution": "alpine",
"tag": "3.20",
"architecture": "x86_64",
"variant": "doc",
"path": ".polycotylus/alpine/3.20/x86_64/py3-99---s1lly---name---packag3--x--y--z-doc-1.2.3-r1.apk",
"signature_path": None
}, {
"distribution": "alpine",
"tag": "3.20",
"architecture": "x86_64",
"variant": "main",
"path": ".polycotylus/alpine/3.20/x86_64/py3-99---s1lly---name---packag3--x--y--z-1.2.3-r1.apk",
"signature_path": None
}, {
"distribution": "alpine",
"tag": "3.20",
"architecture": "x86_64",
"variant": "pyc",
"path": ".polycotylus/alpine/3.20/x86_64/py3-99---s1lly---name---packag3--x--y--z-pyc-1.2.3-r1.apk",
"signature_path": None
}, {
"distribution": "alpine",
"tag": "edge",
Expand Down

0 comments on commit 54f6cda

Please sign in to comment.