Bump minimum Python version to 3.10

This commit is contained in:
jaseg 2023-04-15 22:12:45 +02:00
parent 3556dc081b
commit 4bd1097fc1
3 changed files with 39 additions and 29 deletions

View file

@ -58,26 +58,6 @@ test:ubuntu2204:
paths:
- gerbonara_test_failures/*
test:ubuntu2004:
stage: test
image: "registry.gitlab.com/gerbolyze/build-containers/ubuntu:20.04"
script:
- python3 -m pip install pytest beautifulsoup4 pillow numpy slugify lxml click scipy
- python3 -m pytest -o 'testpaths=gerbonara/tests' -o 'norecursedirs=*'
dependencies:
- build:archlinux
cache:
key: test-image-cache
paths:
- gerbonara/tests/image_cache/*.svg
- gerbonara/tests/image_cache/*.png
artifacts:
name: "gerbolyze-$CI_COMMIT_REF_NAME-gerbonara"
when: on_failure
paths:
- gerbonara_test_failures/*
docs:archlinux:
stage: test
image: "registry.gitlab.com/gerbolyze/build-containers/archlinux:latest"

View file

@ -5,6 +5,8 @@ import time
from dataclasses import field
import math
import uuid
from contextlib import contextmanager
from itertools import cycle
@sexp_type('color')
@ -20,14 +22,43 @@ class Stroke:
width: Named(float) = 0.254
type: Named(AtomChoice(Atom.dash, Atom.dot, Atom.dash_dot_dot, Atom.dash_dot, Atom.default, Atom.solid)) = Atom.default
color: Color = None
@property
def width_mil(self):
return mm_to_mil(self.width)
class Dasher:
def __init__(self, stroke):
self.width = stroke.width
gap = 4*stroke.width
dot = 0
gap = 11*stroke.width
self.pattern = {
Atom.dash: [dash, gap],
Atom.dot: [dot, gap],
Atom.dash_dot_dot: [dash, gap, dot, gap, dot, gap],
Atom.dash_dot: [dash, gap, dot, gap],
Atom.default: [1e99],
Atom.solid: [1e99]}[stroke.type]
self.start_x, self.start_y = None, None
self.cur_x, self.cur_y = None, None
self.segments = []
def move(self, x, y):
self.start_x, self.start_y = x, y
def line(x, y):
if x is None or y is None:
raise ValueError('line() called before move()')
self.segments.append((self.cur_x, self.cur_y, x, y))
cur_x, cur_y = x, y
def close():
self.segments.append((self.cur_x, self.cur_y, start_x, start_y))
def __iter__(self):
offset = 0
for length, stroked in cycle(zip(self.pattern, cycle([True, False]))):
for x1, y1, x2, y2 in segments:
segment_length = math.dist((x1, y1), (x2, y2))
@width_mil.setter
def width_mil(self, value):
self.width = mil_to_mm(value)
@sexp_type('xy')

View file

@ -49,9 +49,8 @@ setup(
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Artistic Software',
'Topic :: Multimedia :: Graphics',
'Topic :: Printing',
@ -62,5 +61,5 @@ setup(
'Typing :: Typed',
],
keywords='gerber excellon pcb',
python_requires='>=3.8',
python_requires='>=3.10',
)