Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,52 @@
From 2f9cd402d3293f6efe0f3ac06f17c6c14edbed86 Mon Sep 17 00:00:00 2001
From: James Hilliard <james.hilliard1@gmail.com>
Date: Sun, 25 Jun 2023 17:39:19 -0600
Subject: [PATCH] Fix include directory when cross compiling (#9129)
Upstream-Status: Backport [https://github.com/pyca/cryptography/pull/9129]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
src/rust/cryptography-cffi/build.rs | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/rust/cryptography-cffi/build.rs b/src/rust/cryptography-cffi/build.rs
index 07590ad2e..384af1ddb 100644
--- a/src/rust/cryptography-cffi/build.rs
+++ b/src/rust/cryptography-cffi/build.rs
@@ -47,9 +47,14 @@ fn main() {
)
.unwrap();
println!("cargo:rustc-cfg=python_implementation=\"{}\"", python_impl);
- let python_include = run_python_script(
+ let python_includes = run_python_script(
&python,
- "import sysconfig; print(sysconfig.get_path('include'), end='')",
+ "import os; \
+ import setuptools.dist; \
+ import setuptools.command.build_ext; \
+ b = setuptools.command.build_ext.build_ext(setuptools.dist.Distribution()); \
+ b.finalize_options(); \
+ print(os.pathsep.join(b.include_dirs), end='')",
)
.unwrap();
let openssl_include =
@@ -59,12 +64,15 @@ fn main() {
let mut build = cc::Build::new();
build
.file(openssl_c)
- .include(python_include)
.include(openssl_include)
.flag_if_supported("-Wconversion")
.flag_if_supported("-Wno-error=sign-conversion")
.flag_if_supported("-Wno-unused-parameter");
+ for python_include in env::split_paths(&python_includes) {
+ build.include(python_include);
+ }
+
// Enable abi3 mode if we're not using PyPy.
if python_impl != "PyPy" {
// cp37 (Python 3.7 to help our grep when we some day drop 3.7 support)
--
2.30.2
@@ -0,0 +1,45 @@
From b7dd3ce1d75d1e6255e1aca82aa7f401d4246a75 Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Tue, 17 May 2022 17:22:48 +0800
Subject: [PATCH] pyproject.toml: remove --benchmark-disable option
The new version introduced below change, so remove the option
to avoid python3-pytest-benchmark rdepends to fix the gap.
496703c8 Refs #7079 -- added basic scaffholding for benchmarks (#7087)
Fixes:
# ./run-ptest
Free memory: 31.283 GB
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --benchmark-disable
inifile: /usr/lib/python3-cryptography/ptest/pyproject.toml
rootdir: /usr/lib/python3-cryptography/ptest
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
pyproject.toml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index b2e511f..4a285af 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -85,7 +85,7 @@ line-length = 79
target-version = ["py37"]
[tool.pytest.ini_options]
-addopts = "-r s --capture=no --strict-markers --benchmark-disable"
+addopts = "-r s --capture=no --strict-markers"
console_output_style = "progress-even-when-capture-no"
markers = [
"skip_fips: this test is not executed in FIPS mode",
@@ -151,4 +151,4 @@ git-only = [
"ci-constraints-requirements.txt",
".gitattributes",
".gitignore",
-]
\ No newline at end of file
+]
@@ -0,0 +1,10 @@
#!/usr/bin/env python3
# https://stackoverflow.com/questions/22102999/get-total-physical-memory-in-python/28161352
import sys
meminfo = dict((i.split()[0].rstrip(':'),int(i.split()[1])) for i in open('/proc/meminfo').readlines())
mem_free = meminfo['MemTotal']/1024./1024.
if mem_free < 2.:
print("Insufficient free memory({:.3f}): requires > 2 GB".format(mem_free))
sys.exit(1)
else:
print("Free memory: {:.3f} GB".format(mem_free))
@@ -0,0 +1,9 @@
#!/bin/sh
if ./check-memfree.py; then
# Skip the bench test module, we don't yet have pytest3-benchmark in core
# and these are more benchmarks than unit tests.
pytest --automake -k 'not bench'
else
echo "SKIP: crytography.not_enough_memory"
fi