OBS-URL: https://build.opensuse.org/package/show/science/libArcus-lulzbot?expand=0&rev=42
290 lines
11 KiB
Diff
290 lines
11 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index eb82b6e..f7a7aff 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -61,7 +61,7 @@ set(arcus_HDRS
|
|
)
|
|
|
|
set(ARCUS_VERSION 1.1.0)
|
|
-set(ARCUS_SOVERSION 3)
|
|
+set(ARCUS_SOVERSION 1)
|
|
|
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
|
|
|
diff --git a/cmake/FindSIP.cmake b/cmake/FindSIP.cmake
|
|
index 1de4623..e15e2b4 100644
|
|
--- a/cmake/FindSIP.cmake
|
|
+++ b/cmake/FindSIP.cmake
|
|
@@ -8,17 +8,12 @@
|
|
#
|
|
# This file defines the following variables:
|
|
#
|
|
-# SIP_VERSION - The version of SIP found expressed as a 6 digit hex number
|
|
-# suitable for comparision as a string.
|
|
+# SIP_VERSION - SIP version.
|
|
#
|
|
-# SIP_VERSION_STR - The version of SIP found as a human readable string.
|
|
+# SIP_EXECUTABLE - Path to the SIP executable.
|
|
#
|
|
-# SIP_BINARY_PATH - Path and filename of the SIP command line executable.
|
|
+# SIP_INCLUDE_DIRS - The SIP include directories.
|
|
#
|
|
-# SIP_INCLUDE_DIR - Directory holding the SIP C++ header file.
|
|
-#
|
|
-# SIP_DEFAULT_SIP_DIR - Default directory where .sip files should be installed
|
|
-# into.
|
|
|
|
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
|
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
@@ -29,41 +24,69 @@ if(APPLE)
|
|
set(CMAKE_FIND_FRAMEWORK LAST)
|
|
endif()
|
|
|
|
-find_package(PythonInterp 3.4.0 REQUIRED)
|
|
-find_package(PythonLibs 3.4.0 REQUIRED)
|
|
+# FIXME: Use FindPython3 to find Python, new in CMake 3.12.
|
|
+# However currently on our CI server it finds the wrong Python version and then doesn't find the headers.
|
|
+find_package(PythonInterp 3.10 REQUIRED)
|
|
+find_package(PythonLibs 3.10 REQUIRED)
|
|
+
|
|
+# Define variables that are available in FindPython3, so there's no need to branch off in the later part.
|
|
+set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
|
|
+set(Python3_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
|
|
+set(Python3_LIBRARIES ${PYTHON_LIBRARIES})
|
|
+set(Python3_VERSION_MINOR "${PYTHON_VERSION_MINOR}")
|
|
|
|
-IF(SIP_VERSION)
|
|
- # Already in cache, be silent
|
|
- SET(SIP_FOUND TRUE)
|
|
-ELSE(SIP_VERSION)
|
|
+execute_process(
|
|
+ COMMAND ${Python3_EXECUTABLE} -c
|
|
+ "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False))"
|
|
+ RESULT_VARIABLE _process_status
|
|
+ OUTPUT_VARIABLE _process_output
|
|
+ OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
+)
|
|
+if(${_process_status} EQUAL 0)
|
|
+ string(STRIP ${_process_output} Python3_SITELIB)
|
|
+else()
|
|
+ message(FATAL_ERROR "Failed to get Python3_SITELIB. Error: ${_process_output}")
|
|
+endif()
|
|
+
|
|
+execute_process(
|
|
+ COMMAND ${Python3_EXECUTABLE} -c
|
|
+ "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False))"
|
|
+ RESULT_VARIABLE _process_status
|
|
+ OUTPUT_VARIABLE _process_output
|
|
+ OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
+)
|
|
+if(${_process_status} EQUAL 0)
|
|
+ string(STRIP ${_process_output} Python3_SITEARCH)
|
|
+else()
|
|
+ message(FATAL_ERROR "Failed to get Python3_SITEARCH. Error: ${_process_output}")
|
|
+endif()
|
|
|
|
- FIND_FILE(_find_sip_py FindSIP.py PATHS ${CMAKE_MODULE_PATH})
|
|
+get_filename_component(_python_binary_path ${Python3_EXECUTABLE} DIRECTORY)
|
|
|
|
- SET(ENV{PYTHONPATH} ${CMAKE_INSTALL_PREFIX}/${PYTHON_SITE_PACKAGES_DIR})
|
|
- EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_sip_py}
|
|
- OUTPUT_VARIABLE sip_config
|
|
- RESULT_VARIABLE sip_config_returncode)
|
|
- IF(sip_config_returncode EQUAL 0)
|
|
- STRING(REGEX REPLACE "^sip_version:([^\n]+).*$" "\\1" SIP_VERSION ${sip_config})
|
|
- STRING(REGEX REPLACE ".*\nsip_version_num:([^\n]+).*$" "\\1" SIP_VERSION_NUM ${sip_config})
|
|
- STRING(REGEX REPLACE ".*\nsip_version_str:([^\n]+).*$" "\\1" SIP_VERSION_STR ${sip_config})
|
|
- STRING(REGEX REPLACE ".*\nsip_bin:([^\n]+).*$" "\\1" SIP_BINARY_PATH ${sip_config})
|
|
- STRING(REGEX REPLACE ".*\ndefault_sip_dir:([^\n]+).*$" "\\1" SIP_DEFAULT_SIP_DIR ${sip_config})
|
|
- STRING(REGEX REPLACE ".*\nsip_inc_dir:([^\n]+).*$" "\\1" SIP_INCLUDE_DIR ${sip_config})
|
|
- SET(SIP_FOUND TRUE)
|
|
- ENDIF(sip_config_returncode EQUAL 0)
|
|
+find_program(SIP_EXECUTABLE sip
|
|
+ HINTS ${CMAKE_PREFIX_PATH}/bin ${CMAKE_INSTALL_PATH}/bin ${_python_binary_path} ${Python3_SITELIB}/PyQt5
|
|
+)
|
|
|
|
- IF(SIP_FOUND)
|
|
- IF(NOT SIP_FIND_QUIETLY)
|
|
- MESSAGE(STATUS "Found SIP version: ${SIP_VERSION_STR}")
|
|
- ENDIF(NOT SIP_FIND_QUIETLY)
|
|
+find_path(SIP_INCLUDE_DIRS sip.h
|
|
+ HINTS ${CMAKE_PREFIX_PATH}/include ${CMAKE_INSTALL_PATH}/include ${Python3_INCLUDE_DIRS} ${Python3_SITELIB}/PyQt5
|
|
+)
|
|
|
|
- include(${CMAKE_MODULE_PATH}/SIPMacros.cmake)
|
|
- ELSE(SIP_FOUND)
|
|
- IF(SIP_FIND_REQUIRED)
|
|
- MESSAGE(FATAL_ERROR "Could not find SIP")
|
|
- ENDIF(SIP_FIND_REQUIRED)
|
|
- ENDIF(SIP_FOUND)
|
|
+execute_process(
|
|
+ COMMAND ${Python3_EXECUTABLE} -c "import sip; print(sip.SIP_VERSION_STR)"
|
|
+ RESULT_VARIABLE _process_status
|
|
+ OUTPUT_VARIABLE _process_output
|
|
+ OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
+)
|
|
|
|
-ENDIF(SIP_VERSION)
|
|
+if(${_process_status} EQUAL 0)
|
|
+ string(STRIP ${_process_output} SIP_VERSION)
|
|
+endif()
|
|
+
|
|
+include(FindPackageHandleStandardArgs)
|
|
+find_package_handle_standard_args(SIP REQUIRED_VARS SIP_EXECUTABLE SIP_INCLUDE_DIRS VERSION_VAR SIP_VERSION)
|
|
+
|
|
+if(SIP_FOUND)
|
|
+ include(${CMAKE_CURRENT_LIST_DIR}/SIPMacros.cmake)
|
|
+endif()
|
|
|
|
+mark_as_advanced(SIP_EXECUTABLE SIP_INCLUDE_DIRS SIP_VERSION)
|
|
diff --git a/cmake/FindSIP.py b/cmake/FindSIP.py
|
|
deleted file mode 100644
|
|
index d3fb643..0000000
|
|
--- a/cmake/FindSIP.py
|
|
+++ /dev/null
|
|
@@ -1,62 +0,0 @@
|
|
-# FindSIP.py
|
|
-#
|
|
-# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
|
|
-# Redistribution and use is allowed according to the terms of the BSD license.
|
|
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
-
|
|
-import sys
|
|
-import os.path
|
|
-
|
|
-def fail(msg="Unable to determine your sip configuration."):
|
|
- print(msg)
|
|
- sys.exit(1)
|
|
-
|
|
-try:
|
|
- # Try the old sipconfig. Many Linux distros still ship this in their packages.
|
|
- import sipconfig
|
|
- sipcfg = sipconfig.Configuration()
|
|
-
|
|
- sip_version = sipcfg.sip_version
|
|
- sip_version = sipcfg.sip_version
|
|
- sip_version_str = sipcfg.sip_version_str
|
|
- sip_bin = sipcfg.sip_bin
|
|
- default_sip_dir = sipcfg.default_sip_dir
|
|
- sip_inc_dir = sipcfg.sip_inc_dir
|
|
-
|
|
-except ImportError:
|
|
- try:
|
|
- if sys.platform == "win32":
|
|
- # Collect the info from the sip module and guess the rest.
|
|
- import sip
|
|
- from distutils import sysconfig
|
|
-
|
|
- sip_version = sip.SIP_VERSION
|
|
- sip_version_str = sip.SIP_VERSION_STR
|
|
-
|
|
- exe = sys.executable
|
|
- if exe is None:
|
|
- fail()
|
|
- base_path = os.path.dirname(exe)
|
|
- sip_bin = os.path.join(base_path, "Lib\\site-packages\\PyQt5\\sip.exe")
|
|
- if not os.path.exists(sip_bin):
|
|
- fail()
|
|
-
|
|
- sip_inc_dir = os.path.join(base_path, "Lib\\site-packages\\PyQt5\\include\\")
|
|
- if not os.path.exists(sip_inc_dir):
|
|
- fail()
|
|
-
|
|
- default_sip_dir = os.path.join(base_path, "Lib\\site-packages\\PyQt5\\sip\\")
|
|
- if not os.path.exists(default_sip_dir):
|
|
- fail()
|
|
- else:
|
|
- fail("Unable to import sipconfig and determine your sip configuration.")
|
|
-
|
|
- except ImportError:
|
|
- fail("Unable to import sipconfig and determine your sip configuration.")
|
|
-
|
|
-print("sip_version:%06.0x" % sip_version)
|
|
-print("sip_version_num:%d" % sip_version)
|
|
-print("sip_version_str:%s" % sip_version_str)
|
|
-print("sip_bin:%s" % sip_bin)
|
|
-print("default_sip_dir:%s" % default_sip_dir)
|
|
-print("sip_inc_dir:%s" % sip_inc_dir)
|
|
diff --git a/cmake/SIPMacros.cmake b/cmake/SIPMacros.cmake
|
|
index efe6d6c..50553e0 100644
|
|
--- a/cmake/SIPMacros.cmake
|
|
+++ b/cmake/SIPMacros.cmake
|
|
@@ -19,7 +19,7 @@
|
|
# The behaviour of the ADD_SIP_PYTHON_MODULE macro can be controlled by a
|
|
# number of variables:
|
|
#
|
|
-# SIP_INCLUDES - List of directories which SIP will scan through when looking
|
|
+# SIP_INCLUDE_DIRS - List of directories which SIP will scan through when looking
|
|
# for included .sip files. (Corresponds to the -I option for SIP.)
|
|
#
|
|
# SIP_TAGS - List of tags to define when running SIP. (Corresponds to the -t
|
|
@@ -35,7 +35,7 @@
|
|
# SIP_EXTRA_OPTIONS - Extra command line options which should be passed on to
|
|
# SIP.
|
|
|
|
-SET(SIP_INCLUDES)
|
|
+SET(SIP_INCLUDE_DIRS)
|
|
SET(SIP_TAGS)
|
|
SET(SIP_CONCAT_PARTS 8)
|
|
SET(SIP_DISABLE_FEATURES)
|
|
@@ -102,17 +102,16 @@ MACRO(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP)
|
|
OUTPUT ${_sip_output_files}
|
|
COMMAND ${CMAKE_COMMAND} -E echo ${message}
|
|
COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
|
|
- COMMAND ${SIP_BINARY_PATH} ${_sip_tags} ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} ${_sip_includes} ${_abs_module_sip}
|
|
+ COMMAND ${SIP_EXECUTABLE} ${_sip_tags} ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} ${_sip_includes} ${_abs_module_sip}
|
|
DEPENDS ${_abs_module_sip} ${SIP_EXTRA_FILES_DEPEND}
|
|
)
|
|
- # not sure if type MODULE could be uses anywhere, limit to cygwin for now
|
|
- IF (CYGWIN OR APPLE)
|
|
- ADD_LIBRARY(${_logical_name} MODULE ${_sip_output_files} ${SIP_EXTRA_SOURCE_FILES})
|
|
- ELSE (CYGWIN OR APPLE)
|
|
- ADD_LIBRARY(${_logical_name} SHARED ${_sip_output_files} ${SIP_EXTRA_SOURCE_FILES})
|
|
- ENDIF (CYGWIN OR APPLE)
|
|
+ ADD_LIBRARY(${_logical_name} MODULE ${_sip_output_files} ${SIP_EXTRA_SOURCE_FILES})
|
|
IF (NOT APPLE)
|
|
- TARGET_LINK_LIBRARIES(${_logical_name} ${PYTHON_LIBRARIES})
|
|
+ IF ("${Python3_VERSION_MINOR}" GREATER 7)
|
|
+ MESSAGE(STATUS "Python > 3.7 - not linking to libpython")
|
|
+ ELSE ()
|
|
+ TARGET_LINK_LIBRARIES(${_logical_name} ${Python3_LIBRARIES})
|
|
+ ENDIF ()
|
|
ENDIF (NOT APPLE)
|
|
TARGET_LINK_LIBRARIES(${_logical_name} ${EXTRA_LINK_LIBRARIES})
|
|
IF (APPLE)
|
|
@@ -121,10 +120,9 @@ MACRO(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP)
|
|
SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES PREFIX "" OUTPUT_NAME ${_child_module_name})
|
|
|
|
IF (WIN32)
|
|
- SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES SUFFIX ".pyd" IMPORT_PREFIX "_")
|
|
+ SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES SUFFIX ".pyd" IMPORT_PREFIX "_")
|
|
ENDIF (WIN32)
|
|
|
|
- INSTALL(TARGETS ${_logical_name} DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/${_parent_module_path}")
|
|
+ INSTALL(TARGETS ${_logical_name} DESTINATION "${Python3_SITEARCH}/${_parent_module_path}")
|
|
|
|
ENDMACRO(ADD_SIP_PYTHON_MODULE)
|
|
-
|
|
diff --git a/src/Socket_p.h b/src/Socket_p.h
|
|
index 1b9e220..7722800 100644
|
|
--- a/src/Socket_p.h
|
|
+++ b/src/Socket_p.h
|
|
@@ -362,7 +362,7 @@ namespace Arcus
|
|
return;
|
|
}
|
|
|
|
- uint32_t message_size = message->ByteSize();
|
|
+ uint32_t message_size = message->ByteSizeLong();
|
|
if(platform_socket.writeUInt32(message_size) == -1)
|
|
{
|
|
error(ErrorCode::SendFailedError, "Could not send message size");
|
|
@@ -548,7 +548,7 @@ namespace Arcus
|
|
|
|
google::protobuf::io::ArrayInputStream array(wire_message->data, wire_message->size);
|
|
google::protobuf::io::CodedInputStream stream(&array);
|
|
- stream.SetTotalBytesLimit(message_size_maximum, message_size_warning);
|
|
+ stream.SetTotalBytesLimit(message_size_maximum);
|
|
if(!message->ParseFromCodedStream(&stream))
|
|
{
|
|
error(ErrorCode::ParseFailedError, "Failed to parse message:" + std::string(wire_message->data));
|