Merge pull request #173 from night1rider/wolfssl-py-fixes-for-tests
Wolfssl py fixes for runtime usagepull/175/head
commit
5ed8935a9a
|
|
@ -1,33 +1,19 @@
|
|||
# Enable test directory installation for wolfcrypt-py
|
||||
#
|
||||
# This include file configures wolfcrypt-py to install its test directory
|
||||
# to the target system for running Python binding tests.
|
||||
# Declarative on purpose: this inc is included by wolfssl_conditional_require()
|
||||
# from an anonymous function, and python () blocks registered that late never
|
||||
# run. FILES uses the literal package name because expandKeys() has already run.
|
||||
|
||||
WOLFCRYPT_PY_TEST_DIR = "${S}"
|
||||
WOLFCRYPT_PY_DIR = "/home/root/wolf-py-tests/wolfcrypt-py-test"
|
||||
WOLFCRYPT_PY_TEST_TARGET_DIR = "${D}${WOLFCRYPT_PY_DIR}"
|
||||
|
||||
python () {
|
||||
distro_version = d.getVar('DISTRO_VERSION', True)
|
||||
wolfcrypt_py_test_dir = d.getVar('WOLFCRYPT_PY_TEST_DIR', True)
|
||||
wolfcrypt_py_test_target_dir = d.getVar('WOLFCRYPT_PY_TEST_TARGET_DIR', True)
|
||||
|
||||
installDirCmd = 'install -m 0755 -d "%s"\n' % wolfcrypt_py_test_target_dir
|
||||
cpWolfcryptPyTestCmd = 'cp -r %s/* %s\n' % (wolfcrypt_py_test_dir, wolfcrypt_py_test_target_dir)
|
||||
|
||||
d.appendVar('do_install', installDirCmd)
|
||||
d.appendVar('do_install', cpWolfcryptPyTestCmd)
|
||||
|
||||
pn = d.getVar('PN', True)
|
||||
wolfcrypt_py_dir = d.getVar('WOLFCRYPT_PY_DIR', True)
|
||||
|
||||
# Legacy always uses underscore syntax
|
||||
files_var_name = 'FILES_' + pn
|
||||
|
||||
current_files = d.getVar(files_var_name, True) or ""
|
||||
new_files = current_files + ' ' + wolfcrypt_py_dir + '/*'
|
||||
d.setVar(files_var_name, new_files)
|
||||
do_install_append() {
|
||||
install -m 0755 -d "${WOLFCRYPT_PY_TEST_TARGET_DIR}"
|
||||
cp -r ${WOLFCRYPT_PY_TEST_DIR}/* ${WOLFCRYPT_PY_TEST_TARGET_DIR}
|
||||
}
|
||||
|
||||
FILES_wolfcrypt-py += "${WOLFCRYPT_PY_DIR}/*"
|
||||
|
||||
# Python Specific option
|
||||
export PYTHONDONTWRITEBYTECODE = "1"
|
||||
|
|
|
|||
|
|
@ -1,35 +1,19 @@
|
|||
# Enable test directory installation for wolfcrypt-py
|
||||
#
|
||||
# This include file configures wolfcrypt-py to install its test directory
|
||||
# to the target system for running Python binding tests.
|
||||
# Declarative on purpose: this inc is included by wolfssl_conditional_require()
|
||||
# from an anonymous function, and python () blocks registered that late never
|
||||
# run. FILES uses the literal package name because expandKeys() has already run.
|
||||
|
||||
WOLFCRYPT_PY_TEST_DIR = "${S}"
|
||||
WOLFCRYPT_PY_DIR = "/home/root/wolf-py-tests/wolfcrypt-py-test"
|
||||
WOLFCRYPT_PY_TEST_TARGET_DIR = "${D}${WOLFCRYPT_PY_DIR}"
|
||||
|
||||
python () {
|
||||
distro_version = d.getVar('DISTRO_VERSION', True)
|
||||
wolfcrypt_py_test_dir = d.getVar('WOLFCRYPT_PY_TEST_DIR', True)
|
||||
wolfcrypt_py_test_target_dir = d.getVar('WOLFCRYPT_PY_TEST_TARGET_DIR', True)
|
||||
|
||||
installDirCmd = 'install -m 0755 -d "%s"\n' % wolfcrypt_py_test_target_dir
|
||||
cpWolfcryptPyTestCmd = 'cp -r %s/* %s\n' % (wolfcrypt_py_test_dir, wolfcrypt_py_test_target_dir)
|
||||
|
||||
d.appendVar('do_install', installDirCmd)
|
||||
d.appendVar('do_install', cpWolfcryptPyTestCmd)
|
||||
|
||||
pn = d.getVar('PN', True)
|
||||
wolfcrypt_py_dir = d.getVar('WOLFCRYPT_PY_DIR', True)
|
||||
|
||||
if distro_version and (distro_version.startswith('2.') or distro_version.startswith('3.')):
|
||||
files_var_name = 'FILES_' + pn
|
||||
else:
|
||||
files_var_name = 'FILES:' + pn
|
||||
|
||||
current_files = d.getVar(files_var_name, True) or ""
|
||||
new_files = current_files + ' ' + wolfcrypt_py_dir + '/*'
|
||||
d.setVar(files_var_name, new_files)
|
||||
do_install:append() {
|
||||
install -m 0755 -d "${WOLFCRYPT_PY_TEST_TARGET_DIR}"
|
||||
cp -r ${WOLFCRYPT_PY_TEST_DIR}/* ${WOLFCRYPT_PY_TEST_TARGET_DIR}
|
||||
}
|
||||
|
||||
FILES:wolfcrypt-py += "${WOLFCRYPT_PY_DIR}/*"
|
||||
|
||||
# Python Specific option
|
||||
export PYTHONDONTWRITEBYTECODE = "1"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
# Configuration to enable wolf-py-tests support in wolfssl
|
||||
# Python tests may need specific features enabled
|
||||
#
|
||||
# Declarative on purpose: this inc is included by wolfssl_conditional_require()
|
||||
# from an anonymous function, and python () blocks registered that late never
|
||||
# run. FILES uses the literal package name because expandKeys() has already run.
|
||||
EXTRA_OECONF += "--enable-shared"
|
||||
|
||||
WOLFSSL_PY_TEST_CERTS_DIR = "/home/root/wolf-py-tests/certs"
|
||||
|
|
@ -7,27 +11,11 @@ WOLFSSL_PY_CERTS_DIR = "/certs"
|
|||
WOLFSSL_PY_CERTS_INSTALL_DIR = "${D}${WOLFSSL_PY_TEST_CERTS_DIR}"
|
||||
WOLFSSL_PY_CERTS_SOURCE_DIR = "${S}${WOLFSSL_PY_CERTS_DIR}"
|
||||
|
||||
python () {
|
||||
distro_version = d.getVar('DISTRO_VERSION', True)
|
||||
wolfssl_py_certs_install_dir = d.getVar('WOLFSSL_PY_CERTS_INSTALL_DIR', True)
|
||||
wolfssl_py_certs_source_dir = d.getVar('WOLFSSL_PY_CERTS_SOURCE_DIR', True)
|
||||
|
||||
bbnote = 'bbnote "Installing Certs Directory for wolf-py Tests"\n'
|
||||
installDir = 'install -m 0755 -d "%s"\n' % (wolfssl_py_certs_install_dir)
|
||||
cpDer = 'cp -r %s/*.der %s\n' % (wolfssl_py_certs_source_dir, wolfssl_py_certs_install_dir)
|
||||
cpPem = 'cp -r %s/*.pem %s\n' % (wolfssl_py_certs_source_dir, wolfssl_py_certs_install_dir)
|
||||
|
||||
d.appendVar('do_install', bbnote)
|
||||
d.appendVar('do_install', installDir)
|
||||
d.appendVar('do_install', cpDer)
|
||||
d.appendVar('do_install', cpPem)
|
||||
|
||||
pn = d.getVar('PN', True)
|
||||
wolfssl_py_test_certs_dir = d.getVar('WOLFSSL_PY_TEST_CERTS_DIR', True)
|
||||
# Legacy always uses underscore syntax
|
||||
files_var_name = 'FILES_' + pn
|
||||
|
||||
current_files = d.getVar(files_var_name, True) or ""
|
||||
new_files = current_files + ' ' + wolfssl_py_test_certs_dir + '/*'
|
||||
d.setVar(files_var_name, new_files)
|
||||
do_install_append() {
|
||||
bbnote "Installing Certs Directory for wolf-py Tests"
|
||||
install -m 0755 -d "${WOLFSSL_PY_CERTS_INSTALL_DIR}"
|
||||
cp -r ${WOLFSSL_PY_CERTS_SOURCE_DIR}/*.der ${WOLFSSL_PY_CERTS_INSTALL_DIR}
|
||||
cp -r ${WOLFSSL_PY_CERTS_SOURCE_DIR}/*.pem ${WOLFSSL_PY_CERTS_INSTALL_DIR}
|
||||
}
|
||||
|
||||
FILES_wolfssl += "${WOLFSSL_PY_TEST_CERTS_DIR}/*"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
# Configuration to enable wolf-py-tests support in wolfssl
|
||||
# Python tests may need specific features enabled
|
||||
#
|
||||
# Declarative on purpose: this inc is included by wolfssl_conditional_require()
|
||||
# from an anonymous function, and python () blocks registered that late never
|
||||
# run. FILES uses the literal package name because expandKeys() has already run.
|
||||
EXTRA_OECONF += "--enable-shared"
|
||||
|
||||
WOLFSSL_PY_TEST_CERTS_DIR = "/home/root/wolf-py-tests/certs"
|
||||
|
|
@ -7,29 +11,11 @@ WOLFSSL_PY_CERTS_DIR = "/certs"
|
|||
WOLFSSL_PY_CERTS_INSTALL_DIR = "${D}${WOLFSSL_PY_TEST_CERTS_DIR}"
|
||||
WOLFSSL_PY_CERTS_SOURCE_DIR = "${S}${WOLFSSL_PY_CERTS_DIR}"
|
||||
|
||||
python () {
|
||||
distro_version = d.getVar('DISTRO_VERSION', True)
|
||||
wolfssl_py_certs_install_dir = d.getVar('WOLFSSL_PY_CERTS_INSTALL_DIR', True)
|
||||
wolfssl_py_certs_source_dir = d.getVar('WOLFSSL_PY_CERTS_SOURCE_DIR', True)
|
||||
|
||||
bbnote = 'bbnote "Installing Certs Directory for wolf-py Tests"\n'
|
||||
installDir = 'install -m 0755 -d "%s"\n' % (wolfssl_py_certs_install_dir)
|
||||
cpDer = 'cp -r %s/*.der %s\n' % (wolfssl_py_certs_source_dir, wolfssl_py_certs_install_dir)
|
||||
cpPem = 'cp -r %s/*.pem %s\n' % (wolfssl_py_certs_source_dir, wolfssl_py_certs_install_dir)
|
||||
|
||||
d.appendVar('do_install', bbnote)
|
||||
d.appendVar('do_install', installDir)
|
||||
d.appendVar('do_install', cpDer)
|
||||
d.appendVar('do_install', cpPem)
|
||||
|
||||
pn = d.getVar('PN', True)
|
||||
wolfssl_py_test_certs_dir = d.getVar('WOLFSSL_PY_TEST_CERTS_DIR', True)
|
||||
if distro_version and (distro_version.startswith('2.') or distro_version.startswith('3.')):
|
||||
files_var_name = 'FILES_' + pn
|
||||
else:
|
||||
files_var_name = 'FILES:' + pn
|
||||
|
||||
current_files = d.getVar(files_var_name, True) or ""
|
||||
new_files = current_files + ' ' + wolfssl_py_test_certs_dir + '/*'
|
||||
d.setVar(files_var_name, new_files)
|
||||
do_install:append() {
|
||||
bbnote "Installing Certs Directory for wolf-py Tests"
|
||||
install -m 0755 -d "${WOLFSSL_PY_CERTS_INSTALL_DIR}"
|
||||
cp -r ${WOLFSSL_PY_CERTS_SOURCE_DIR}/*.der ${WOLFSSL_PY_CERTS_INSTALL_DIR}
|
||||
cp -r ${WOLFSSL_PY_CERTS_SOURCE_DIR}/*.pem ${WOLFSSL_PY_CERTS_INSTALL_DIR}
|
||||
}
|
||||
|
||||
FILES:wolfssl += "${WOLFSSL_PY_TEST_CERTS_DIR}/*"
|
||||
|
|
|
|||
|
|
@ -1,34 +1,19 @@
|
|||
# Enable test directory installation for wolfssl-py
|
||||
#
|
||||
# This include file configures wolfssl-py to install its test directory
|
||||
# to the target system for running Python binding tests.
|
||||
# Declarative on purpose: this inc is included by wolfssl_conditional_require()
|
||||
# from an anonymous function, and python () blocks registered that late never
|
||||
# run. FILES uses the literal package name because expandKeys() has already run.
|
||||
|
||||
WOLFSSL_PY_TEST_DIR = "${S}"
|
||||
WOLFSSL_PY_DIR = "/home/root/wolf-py-tests/wolfssl-py-test"
|
||||
WOLFSSL_PY_TEST_TARGET_DIR = "${D}${WOLFSSL_PY_DIR}"
|
||||
|
||||
python () {
|
||||
distro_version = d.getVar('DISTRO_VERSION', True)
|
||||
wolfssl_py_test_dir = d.getVar('WOLFSSL_PY_TEST_DIR', True)
|
||||
wolfssl_py_test_target_dir = d.getVar('WOLFSSL_PY_TEST_TARGET_DIR', True)
|
||||
|
||||
installDir = 'install -m 0755 -d "%s"\n' % (wolfssl_py_test_target_dir)
|
||||
cpWolfsslPyTest = 'cp -r %s/* %s\n' % (wolfssl_py_test_dir, wolfssl_py_test_target_dir)
|
||||
|
||||
d.appendVar('do_install', installDir)
|
||||
d.appendVar('do_install', cpWolfsslPyTest)
|
||||
|
||||
# Append to FILES_${PN} within the Python function
|
||||
pn = d.getVar('PN', True)
|
||||
wolfssl_py_dir = d.getVar('WOLFSSL_PY_DIR', True)
|
||||
|
||||
# Legacy always uses underscore syntax
|
||||
files_var_name = 'FILES_' + pn
|
||||
|
||||
current_files = d.getVar(files_var_name, True) or ""
|
||||
new_files = current_files + ' ' + wolfssl_py_dir + '/*'
|
||||
d.setVar(files_var_name, new_files)
|
||||
do_install_append() {
|
||||
install -m 0755 -d "${WOLFSSL_PY_TEST_TARGET_DIR}"
|
||||
cp -r ${WOLFSSL_PY_TEST_DIR}/* ${WOLFSSL_PY_TEST_TARGET_DIR}
|
||||
}
|
||||
|
||||
FILES_wolfssl-py += "${WOLFSSL_PY_DIR}/*"
|
||||
|
||||
# Python Specific option
|
||||
export PYTHONDONTWRITEBYTECODE = "1"
|
||||
|
|
|
|||
|
|
@ -1,36 +1,19 @@
|
|||
# Enable test directory installation for wolfssl-py
|
||||
#
|
||||
# This include file configures wolfssl-py to install its test directory
|
||||
# to the target system for running Python binding tests.
|
||||
# Declarative on purpose: this inc is included by wolfssl_conditional_require()
|
||||
# from an anonymous function, and python () blocks registered that late never
|
||||
# run. FILES uses the literal package name because expandKeys() has already run.
|
||||
|
||||
WOLFSSL_PY_TEST_DIR = "${S}"
|
||||
WOLFSSL_PY_DIR = "/home/root/wolf-py-tests/wolfssl-py-test"
|
||||
WOLFSSL_PY_TEST_TARGET_DIR = "${D}${WOLFSSL_PY_DIR}"
|
||||
|
||||
python () {
|
||||
distro_version = d.getVar('DISTRO_VERSION', True)
|
||||
wolfssl_py_test_dir = d.getVar('WOLFSSL_PY_TEST_DIR', True)
|
||||
wolfssl_py_test_target_dir = d.getVar('WOLFSSL_PY_TEST_TARGET_DIR', True)
|
||||
|
||||
installDir = 'install -m 0755 -d "%s"\n' % (wolfssl_py_test_target_dir)
|
||||
cpWolfsslPyTest = 'cp -r %s/* %s\n' % (wolfssl_py_test_dir, wolfssl_py_test_target_dir)
|
||||
|
||||
d.appendVar('do_install', installDir)
|
||||
d.appendVar('do_install', cpWolfsslPyTest)
|
||||
|
||||
# Append to FILES:${PN} within the Python function
|
||||
pn = d.getVar('PN', True)
|
||||
wolfssl_py_dir = d.getVar('WOLFSSL_PY_DIR', True)
|
||||
|
||||
if distro_version and (distro_version.startswith('2.') or distro_version.startswith('3.')):
|
||||
files_var_name = 'FILES_' + pn
|
||||
else:
|
||||
files_var_name = 'FILES:' + pn
|
||||
|
||||
current_files = d.getVar(files_var_name, True) or ""
|
||||
new_files = current_files + ' ' + wolfssl_py_dir + '/*'
|
||||
d.setVar(files_var_name, new_files)
|
||||
do_install:append() {
|
||||
install -m 0755 -d "${WOLFSSL_PY_TEST_TARGET_DIR}"
|
||||
cp -r ${WOLFSSL_PY_TEST_DIR}/* ${WOLFSSL_PY_TEST_TARGET_DIR}
|
||||
}
|
||||
|
||||
FILES:wolfssl-py += "${WOLFSSL_PY_DIR}/*"
|
||||
|
||||
# Python Specific option
|
||||
export PYTHONDONTWRITEBYTECODE = "1"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
Fall back when typing_extensions cannot provide override (added in
|
||||
typing-extensions 4.4; kirkstone/langdale ship older). override is a
|
||||
no-op at runtime, so a pass-through decorator is equivalent.
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
diff --git a/wolfcrypt/ciphers.py b/wolfcrypt/ciphers.py
|
||||
index b7b8c05..e3e9e25 100644
|
||||
--- a/wolfcrypt/ciphers.py
|
||||
+++ b/wolfcrypt/ciphers.py
|
||||
@@ -29,7 +29,12 @@ from typing import TYPE_CHECKING
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Sequence
|
||||
|
||||
-from typing_extensions import override
|
||||
+try:
|
||||
+ from typing_extensions import override
|
||||
+except ImportError:
|
||||
+ # typing-extensions < 4.4 or absent: override is a no-op type hint
|
||||
+ def override(func):
|
||||
+ return func
|
||||
from wolfcrypt._ffi import ffi as _ffi
|
||||
from wolfcrypt._ffi import lib as _lib
|
||||
from wolfcrypt.exceptions import WolfCryptError, WolfCryptApiError
|
||||
diff --git a/wolfcrypt/hashes.py b/wolfcrypt/hashes.py
|
||||
index 76180af..88ec60b 100644
|
||||
--- a/wolfcrypt/hashes.py
|
||||
+++ b/wolfcrypt/hashes.py
|
||||
@@ -24,7 +24,12 @@ from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import TYPE_CHECKING
|
||||
-from typing_extensions import override
|
||||
+try:
|
||||
+ from typing_extensions import override
|
||||
+except ImportError:
|
||||
+ # typing-extensions < 4.4 or absent: override is a no-op type hint
|
||||
+ def override(func):
|
||||
+ return func
|
||||
|
||||
from wolfcrypt._ffi import ffi as _ffi
|
||||
from wolfcrypt._ffi import lib as _lib
|
||||
|
|
@ -27,6 +27,20 @@ python () {
|
|||
d.appendVar('SRC_URI', ' file://wolfcrypt-py-pyproject-license-compat.patch')
|
||||
}
|
||||
|
||||
# wolfcrypt-py imports typing_extensions.override (needs typing-extensions >= 4.4).
|
||||
# Releases listed here ship an older version (or none at all), so patch in a
|
||||
# no-op fallback decorator instead of depending on the package. Newer releases
|
||||
# build unpatched and get the real runtime dependency.
|
||||
WOLFCRYPT_PY_TYPING_COMPAT_SERIES = "sumo thud warrior zeus dunfell gatesgarth hardknott honister kirkstone langdale"
|
||||
python () {
|
||||
affected = set((d.getVar('WOLFCRYPT_PY_TYPING_COMPAT_SERIES') or '').split())
|
||||
series = set((d.getVar('LAYERSERIES_CORENAMES') or '').split())
|
||||
if affected & series:
|
||||
d.appendVar('SRC_URI', ' file://wolfcrypt-py-typing-extensions-compat.patch')
|
||||
else:
|
||||
wolfssl_varAppend(d, 'RDEPENDS', '${PN}', ' python3-typing-extensions')
|
||||
}
|
||||
|
||||
DEPENDS += " virtual/wolfssl \
|
||||
python3-pip-native \
|
||||
python3-cffi-native \
|
||||
|
|
|
|||
Loading…
Reference in New Issue