Cleanup and python 3.13

This commit is contained in:
Mario Fetka
2025-05-05 10:23:40 +02:00
parent 7c1ee4ca45
commit b56141d74d
121 changed files with 9006 additions and 479 deletions

View File

@@ -0,0 +1,87 @@
From 503c8789db7cb99e4e53cae3c220f80aef07c785 Mon Sep 17 00:00:00 2001
From: Yegor Yefremov <yegorslists@googlemail.com>
Date: Wed, 2 Apr 2025 10:12:34 +0200
Subject: [PATCH] CMakeLists.txt: bump CMake version to 3.15
Older CMake versions are treated as deprecated.
merged with cherry-picks of preceding changes:
3861e7dc9e83f2f6ff4e1579cf3bbf63a6827105
de9f01ece34d2fe6e842e0250a38f4b16eda2429
3f314ed78111473b7cbf1b9d1854c9f6322eea7a
diff -u a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,5 @@
+cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
+
# Project
project(libftdi1 C)
set(MAJOR_VERSION 1)
@@ -12,7 +14,6 @@
set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_COLOR_MAKEFILE ON)
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
add_definitions(-Wall)
@@ -211,30 +212,25 @@
set ( LIBFTDI_USE_FILE ${CMAKE_INSTALL_PREFIX}/${LIBFTDI_CMAKE_CONFIG_DIR}/UseLibFTDI1.cmake )
-if(CMAKE_VERSION VERSION_LESS 2.8.8)
- configure_file ( cmake/LibFTDI1Config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibFTDI1Config.cmake @ONLY )
- configure_file ( cmake/LibFTDI1ConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/LibFTDI1ConfigVersion.cmake @ONLY )
-else ()
- include(CMakePackageConfigHelpers)
-
- configure_package_config_file (
- cmake/LibFTDI1Config.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/LibFTDI1Config.cmake
- INSTALL_DESTINATION ${LIBFTDI_CMAKE_CONFIG_DIR}
- PATH_VARS
- LIBFTDI_USE_FILE
- LIBFTDI_ROOT_DIR
- LIBFTDI_INCLUDE_DIR
- LIBFTDI_INCLUDE_DIRS
- LIBFTDI_LIBRARY_DIRS
- NO_CHECK_REQUIRED_COMPONENTS_MACRO
- )
- write_basic_package_version_file (
- LibFTDI1ConfigVersion.cmake
- VERSION ${LIBFTDI_VERSION_STRING}
- COMPATIBILITY AnyNewerVersion
- )
-endif ()
+include(CMakePackageConfigHelpers)
+
+configure_package_config_file (
+ cmake/LibFTDI1Config.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/LibFTDI1Config.cmake
+ INSTALL_DESTINATION ${LIBFTDI_CMAKE_CONFIG_DIR}
+ PATH_VARS
+ LIBFTDI_USE_FILE
+ LIBFTDI_ROOT_DIR
+ LIBFTDI_INCLUDE_DIR
+ LIBFTDI_INCLUDE_DIRS
+ LIBFTDI_LIBRARY_DIRS
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+)
+write_basic_package_version_file (
+ LibFTDI1ConfigVersion.cmake
+ VERSION ${LIBFTDI_VERSION_STRING}
+ COMPATIBILITY AnyNewerVersion
+)
install ( FILES
--- a/examples/cmake_example/CMakeLists.txt
+++ b/examples/cmake_example/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required ( VERSION 2.8 )
+cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project ( example C )

View File

@@ -0,0 +1,25 @@
https://bugs.gentoo.org/934224
http://developer.intra2net.com/git/?p=libftdi;a=commit;h=abd19b721f7e9b4d514ed319ece173ebc7b1ea72
From abd19b721f7e9b4d514ed319ece173ebc7b1ea72 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 19 Dec 2022 17:40:43 +0100
Subject: [PATCH] python: move from distutils to sysconfig
The distutils module was deprecated in Python 3.10, and will be removed
in 3.12 [1], thus switch to the sysconfig module instead.
[1] https://peps.python.org/pep-0632/
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -42,7 +42,7 @@ endif ()
set_target_properties ( ${SWIG_MODULE_ftdi1_REAL_NAME} PROPERTIES NO_SONAME ON )
-execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print( sysconfig.get_python_lib( plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}' ) )"
+execute_process ( COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print( sysconfig.get_path( 'platlib', vars={'platbase': '${CMAKE_INSTALL_PREFIX}'} ) )"
OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE )
--
1.7.1

View File

@@ -0,0 +1,82 @@
https://bugs.gentoo.org/953348
http://developer.intra2net.com/git/?p=libftdi;a=commit;h=ff7707e3ffadc09af420b26370b9e097a5b2bc8b
From ff7707e3ffadc09af420b26370b9e097a5b2bc8b Mon Sep 17 00:00:00 2001
From: William S Fulton <wsf@fultondesigns.co.uk>
Date: Fri, 18 Oct 2024 09:38:20 +0200
Subject: [PATCH] python: update for SWIG 4.3
SWIG 4.3 comes with an API change to the SWIG_Python_AppendOutput()
function, so switch to the recommended SWIG_AppendOutput() instead.
Because the new function is a macro in fact also switch to the {..}
delimiters as the code needs to be preprocessed. The change is
compatible with the previous SWIG releases 4.2 and 4.1 at least.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2319133
Related: https://github.com/swig/swig/pull/2907
---
python/ftdi1.i | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/python/ftdi1.i b/python/ftdi1.i
index 8b179f9..fac4d16 100644
--- a/python/ftdi1.i
+++ b/python/ftdi1.i
@@ -52,7 +52,7 @@ char * str2charp_size(PyObject* pyObj, int * size)
%enddef
%feature("autodoc", ftdi_usb_find_all_docstring) ftdi_usb_find_all;
%typemap(in,numinputs=0) SWIGTYPE** OUTPUT ($*ltype temp) %{ $1 = &temp; %}
-%typemap(argout) SWIGTYPE** OUTPUT %{ $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj((void*)*$1,$*descriptor,0)); %}
+%typemap(argout,noblock=1) SWIGTYPE** OUTPUT { $result = SWIG_AppendOutput($result, SWIG_NewPointerObj((void*)*$1,$*descriptor,0)); }
%apply SWIGTYPE** OUTPUT { struct ftdi_device_list **devlist };
int ftdi_usb_find_all(struct ftdi_context *ftdi, struct ftdi_device_list **devlist,
int vendor, int product);
@@ -92,12 +92,12 @@ char * str2charp_size(PyObject* pyObj, int * size)
%enddef
%feature("autodoc", ftdi_read_data_docstring) ftdi_read_data;
%typemap(in,numinputs=1) (unsigned char *buf, int size) %{ $2 = PyInt_AsLong($input);$1 = (unsigned char*)malloc($2*sizeof(char)); %}
-%typemap(argout) (unsigned char *buf, int size) %{
+%typemap(argout,noblock=1) (unsigned char *buf, int size) {
if(result<0)
$2=0;
- $result = SWIG_Python_AppendOutput($result, charp2str((char*)$1, $2));
+ $result = SWIG_AppendOutput($result, charp2str((char*)$1, $2));
free($1);
-%}
+}
int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size);
%clear (unsigned char *buf, int size);
@@ -119,12 +119,12 @@ char * str2charp_size(PyObject* pyObj, int * size)
%enddef
%feature("autodoc", ftdi_read_pins_docstring) ftdi_read_pins;
%typemap(in,numinputs=0) unsigned char *pins ($*ltype temp) %{ $1 = &temp; %}
-%typemap(argout) (unsigned char *pins) %{ $result = SWIG_Python_AppendOutput($result, charp2str((char*)$1, 1)); %}
+%typemap(argout,noblock=1) (unsigned char *pins) { $result = SWIG_AppendOutput($result, charp2str((char*)$1, 1)); }
int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins);
%clear unsigned char *pins;
%typemap(in,numinputs=0) unsigned char *latency ($*ltype temp) %{ $1 = &temp; %}
-%typemap(argout) (unsigned char *latency) %{ $result = SWIG_Python_AppendOutput($result, charp2str((char*)$1, 1)); %}
+%typemap(argout,noblock=1) (unsigned char *latency) { $result = SWIG_AppendOutput($result, charp2str((char*)$1, 1)); }
int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency);
%clear unsigned char *latency;
@@ -137,12 +137,12 @@ char * str2charp_size(PyObject* pyObj, int * size)
%clear int* value;
%typemap(in,numinputs=1) (unsigned char *buf, int size) %{ $2 = PyInt_AsLong($input);$1 = (unsigned char*)malloc($2*sizeof(char)); %}
-%typemap(argout) (unsigned char *buf, int size) %{
+%typemap(argout,noblock=1) (unsigned char *buf, int size) {
if(result<0)
$2=0;
- $result = SWIG_Python_AppendOutput($result, charp2str((char*)$1, $2));
+ $result = SWIG_AppendOutput($result, charp2str((char*)$1, $2));
free($1);
-%}
+}
int ftdi_get_eeprom_buf(struct ftdi_context *ftdi, unsigned char * buf, int size);
%clear (unsigned char *buf, int size);
--
1.7.1