python-automat: revert patch to unbreak on py2

This commit is contained in:
Andrew Benson 2023-01-26 22:21:38 -06:00 committed by Michael Aldridge
parent fd0017bec2
commit e014c34f1f
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,37 @@
Our builders still use the py2 version of this package.
--- a/automat/_methodical.py
+++ b/automat/_methodical.py
@@ -4,9 +4,15 @@
from functools import wraps
from itertools import count
-from inspect import getfullargspec as getArgsSpec
+try:
+ # Python 3
+ from inspect import getfullargspec as getArgsSpec
+except ImportError:
+ # Python 2
+ from inspect import getargspec as getArgsSpec
import attr
+import six
from ._core import Transitioner, Automaton
from ._introspection import preserveName
@@ -30,13 +36,13 @@
return ArgSpec(
args=tuple(spec.args),
varargs=spec.varargs,
- varkw=spec.varkw,
+ varkw=spec.varkw if six.PY3 else spec.keywords,
defaults=spec.defaults if spec.defaults else (),
kwonlyargs=tuple(spec.kwonlyargs),
kwonlydefaults=(
tuple(spec.kwonlydefaults.items())
if spec.kwonlydefaults else ()
- ),
+ ) if six.PY3 else (),
annotations=tuple(spec.annotations.items()),
)

View File

@ -1,7 +1,7 @@
# Template file for 'python-automat'
pkgname=python-automat
version=22.10.0
revision=1
revision=2
build_style=python-module
hostmakedepends="python-setuptools python3-setuptools"
depends="python-setuptools python-attrs python-six"