Skip to content

Commit

Permalink
Merge pull request #33 from Idein/drop-python-3.6
Browse files Browse the repository at this point in the history
Drop python 3.6
  • Loading branch information
amutake authored Feb 14, 2024
2 parents 0c29f6e + 4450c85 commit 58b5ea3
Show file tree
Hide file tree
Showing 9 changed files with 803 additions and 811 deletions.
44 changes: 25 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
version: 2.1

references:
python-versions: &python-versions ["3.6", "3.7", "3.8", "3.9", "3.10"]
image-tags: &image-tags
- "python:3.7-buster"
- "python:3.8-buster"
- "python:3.9-bullseye"
- "python:3.10-bullseye"
- "python:3.11-bullseye"
- "python:3.12-bullseye"

commands:
install-python-dev-tools:
Expand All @@ -22,13 +28,13 @@ commands:
install-old-poetry:
steps:
- run:
name: Install poetry 1.1
name: Install poetry 1.5.1
command: |
python3 -m pip install --user pipx
python3 -m pipx ensurepath
echo 'export PATH=$HOME/.local/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
pipx install poetry==1.1.15
pipx install poetry==1.5.1
poetry-install:
steps:
# See: https://circleci.com/docs/2.0/language-python/#cache-dependencies
Expand Down Expand Up @@ -59,7 +65,7 @@ commands:
jobs:
lint:
docker:
- image: python:3.10-buster
- image: python:3.10-bullseye
auth: &docker-hub-auth
username: $DOCKER_USER
password: $DOCKER_PASS
Expand All @@ -79,23 +85,23 @@ jobs:
test:
parameters:
python-version:
image-tag:
type: string
docker:
- image: python:<<parameters.python-version>>-buster
- image: <<parameters.image-tag>>
auth: *docker-hub-auth
steps:
- checkout
- install-python-dev-tools
- when:
condition:
equal: ["3.6", << parameters.python-version >> ]
equal: ["python:3.7-buster", << parameters.image-tag >> ]
steps:
- install-old-poetry
- when:
condition:
not:
equal: ["3.6", << parameters.python-version >> ]
equal: ["python:3.7-buster", << parameters.image-tag >> ]
steps:
- install-poetry
- poetry-install
Expand All @@ -104,10 +110,10 @@ jobs:
command: poetry run pytest -v
test-with-up-to-date-dependencies:
parameters:
python-version:
image-tag:
type: string
docker:
- image: python:<<parameters.python-version>>-buster
- image: <<parameters.image-tag>>
auth: *docker-hub-auth
steps:
- checkout
Expand All @@ -117,13 +123,13 @@ jobs:
- install-python-dev-tools
- when:
condition:
equal: ["3.6", << parameters.python-version >> ]
equal: ["python:3.7-buster", << parameters.image-tag >> ]
steps:
- install-old-poetry
- when:
condition:
not:
equal: ["3.6", << parameters.python-version >> ]
equal: ["python:3.7-buster", << parameters.image-tag >> ]
steps:
- install-poetry
- poetry-install
Expand All @@ -133,7 +139,7 @@ jobs:

build-api-doc:
docker:
- image: python:3.10-buster
- image: python:3.10-bullseye
auth: *docker-hub-auth
steps:
- checkout
Expand All @@ -154,7 +160,7 @@ jobs:

build-package:
docker:
- image: python:3.10-buster
- image: python:3.10-bullseye
auth: *docker-hub-auth
steps:
- checkout
Expand All @@ -172,7 +178,7 @@ jobs:

validate-version-with-tag:
docker:
- image: python:3.10-buster
- image: python:3.10-bullseye
auth: *docker-hub-auth
steps:
- checkout
Expand Down Expand Up @@ -217,7 +223,7 @@ jobs:
deploy-package:
docker:
- image: python:3.10-buster
- image: python:3.10-bullseye
auth: *docker-hub-auth
steps:
- checkout
Expand All @@ -244,7 +250,7 @@ workflows:
- docker-hub-creds
matrix:
parameters:
python-version: *python-versions
image-tag: *image-tags
- build-api-doc:
context:
- docker-hub-creds
Expand Down Expand Up @@ -302,13 +308,13 @@ workflows:
- docker-hub-creds
matrix:
parameters:
python-version: *python-versions
image-tag: *image-tags
- test-with-up-to-date-dependencies:
context:
- docker-hub-creds
matrix:
parameters:
python-version: *python-versions
image-tag: *image-tags
- build-api-doc:
context:
- docker-hub-creds
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- Drop support for Python 3.6

## 3.0.0 (2022-11-04)

- Add DRM backend for Display
Expand Down
8 changes: 7 additions & 1 deletion actfw_raspberrypi/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ def update(
int(dst_rect[3] * self.scale),
)
layer = self.camera.add_overlay(
src_buf, size=src_size, format=src_format, layer=2, alpha=255, fullscreen=False, window=rect
src_buf,
size=src_size,
format=src_format,
layer=2,
alpha=255,
fullscreen=False,
window=rect,
)
if self.layer is not None:
self.camera.remove_overlay(self.layer)
Expand Down
1 change: 0 additions & 1 deletion actfw_raspberrypi/vc4/dispmanx.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ class Window(object):
"""

def __init__(self, display, dst, size, layer):

self.display = display
self.size = size
self.layer = layer
Expand Down
48 changes: 43 additions & 5 deletions actfw_raspberrypi/vc4/drm/drm.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,11 @@ class DRMModeObjectProperties(Structure):
} drmModeObjectProperties, *drmModeObjectPropertiesPtr;
"""

_fields_ = [("count_props", c_uint32), ("props", POINTER(c_uint32)), ("prop_values", POINTER(c_uint64))]
_fields_ = [
("count_props", c_uint32),
("props", POINTER(c_uint32)),
("prop_values", POINTER(c_uint64)),
]


class DRMModeResource(Structure):
Expand Down Expand Up @@ -463,7 +467,13 @@ def __init__(self):
self.lib.drmModeObjectGetProperties.restype = POINTER(DRMModeObjectProperties)
self.lib.drmModeFreeObjectProperties.argtypes = [POINTER(DRMModeObjectProperties)]
self.lib.drmModeFreeObjectProperties.restype = None
self.lib.drmModeObjectSetProperty.argtypes = [c_int, c_uint32, c_uint32, c_uint32, c_uint64]
self.lib.drmModeObjectSetProperty.argtypes = [
c_int,
c_uint32,
c_uint32,
c_uint32,
c_uint64,
]
self.lib.drmModeObjectSetProperty.restype = c_int

self.lib.drmIoctl.argtypes = [c_int, c_ulong, c_voidp]
Expand Down Expand Up @@ -585,7 +595,17 @@ def __init__(self, fd, width, height, bpp=24):
offsets[1] = 0
offsets[2] = 0
offsets[3] = 0
res = _drm.add_fb(self.fd, creq.width, creq.height, pixel_format, bo_handles, pitches, offsets, byref(fb), creq.flags)
res = _drm.add_fb(
self.fd,
creq.width,
creq.height,
pixel_format,
bo_handles,
pitches,
offsets,
byref(fb),
creq.flags,
)
if res != 0:
raise RuntimeError("fail to add framebuffer")
self.fb_id = fb
Expand All @@ -598,7 +618,11 @@ def __init__(self, fd, width, height, bpp=24):
raise RuntimeError("fail to map dumb")

self.buffer = mmap.mmap(
self.fd, creq.size, flags=mmap.MAP_SHARED, prot=mmap.PROT_READ | mmap.PROT_WRITE, offset=mreq.offset
self.fd,
creq.size,
flags=mmap.MAP_SHARED,
prot=mmap.PROT_READ | mmap.PROT_WRITE,
offset=mreq.offset,
)

self.write(bytearray(creq.size))
Expand Down Expand Up @@ -639,7 +663,21 @@ def set(self, crtc_id, fb_id, dst, src):
x, y, w, h = dst
x0, y0, w0, h0 = src
flags = 0
res = _drm.set_plane(self.fd, self.plane_id, crtc_id, fb_id, flags, x, y, w, h, x0 << 16, y0 << 16, w0 << 16, h0 << 16)
res = _drm.set_plane(
self.fd,
self.plane_id,
crtc_id,
fb_id,
flags,
x,
y,
w,
h,
x0 << 16,
y0 << 16,
w0 << 16,
h0 << 16,
)
if res != 0:
errno = get_errno()
err = os.strerror(errno)
Expand Down
7 changes: 4 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
#
import os
import sys
from typing import Any, List

import pkg_resources
import sphinx.ext.apidoc
import sphinx_theme
import sphinx_theme # type: ignore[import]

sys.path.insert(0, os.path.abspath("../"))


def setup(app):
def setup(app: Any) -> None:
sphinx.ext.apidoc.main(["-f", "-o", "docs", "."])


Expand Down Expand Up @@ -63,7 +64,7 @@ def setup(app):
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
html_static_path: List[str] = []


autoclass_content = "both"
Loading

0 comments on commit 58b5ea3

Please sign in to comment.