From 90591bb6de3702d5eab37b9d147608450a586a24 Mon Sep 17 00:00:00 2001 From: Ben Udall Date: Tue, 30 Jul 2019 14:58:03 -0600 Subject: [PATCH] Fixed some python build issues --- lib/CMakeLists.txt | 6 ++++-- python/setup.py | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index c4df05efc..6cba30b3d 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6.4) +cmake_minimum_required(VERSION 3.1.0) project(cryptoauth) # Various Options for Build @@ -79,6 +79,8 @@ endif() add_library(cryptoauth ${CRYPTOAUTH_SRC} ${ATCACERT_DEF_SRC}) +set_property(TARGET cryptoauth PROPERTY C_STANDARD 99) + # Add Remaining Sources depending on target library type if(ATCA_PKCS11) set_target_properties(cryptoauth PROPERTIES OUTPUT_NAME "ateccx08pkcs11") @@ -104,7 +106,7 @@ endif() if(LINUX) if(HAS_LIBUSB AND ATCA_HAL_KIT_HID) target_link_libraries(cryptoauth usb-1.0) -elseif(HAS_UDEV AND ATCA_HAL_KIT_HID) +elseif(HAS_LIBUDEV AND ATCA_HAL_KIT_HID) target_link_libraries(cryptoauth udev) endif() target_link_libraries(cryptoauth rt) diff --git a/python/setup.py b/python/setup.py index c093ec64f..f757fec92 100644 --- a/python/setup.py +++ b/python/setup.py @@ -147,7 +147,7 @@ def build_extension(self, ext): try: subprocess.check_output(['cmake', cmakelist_path] + cmake_args, cwd=os.path.abspath(self.build_temp), stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - msg = e.output.decode('ascii') + msg = e.output.decode('utf-8') if 'usb' in msg: msg += '\n\n USB libraries or headers were not located. If USB support is\n' \ ' not required it can be disabled by setting the environment\n' \ @@ -156,13 +156,16 @@ def build_extension(self, ext): ' $ export CRYPTOAUTHLIB_NOUSB=True\n\n' \ ' Run setup.py clean before trying install again or use the pip \n' \ ' option --no-cache-dir\n' - raise Exception(msg) + raise RuntimeError(msg) # Build the library try: subprocess.check_output(['cmake', '--build', '.'] + build_args, cwd=os.path.abspath(self.build_temp), stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: - raise Exception(e.output.decode('ascii')) + if sys.version_info[0] <= 2: + raise RuntimeError(e.output) # Python 2 doesn't handle unicode exceptions + else: + raise RuntimeError(e.output.decode('utf-8')) class CryptoAuthCommandInstall(install):