Skip to content

Commit 90591bb

Browse files
Fixed some python build issues
1 parent 76ccc87 commit 90591bb

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

lib/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 2.6.4)
1+
cmake_minimum_required(VERSION 3.1.0)
22
project(cryptoauth)
33

44
# Various Options for Build
@@ -79,6 +79,8 @@ endif()
7979

8080
add_library(cryptoauth ${CRYPTOAUTH_SRC} ${ATCACERT_DEF_SRC})
8181

82+
set_property(TARGET cryptoauth PROPERTY C_STANDARD 99)
83+
8284
# Add Remaining Sources depending on target library type
8385
if(ATCA_PKCS11)
8486
set_target_properties(cryptoauth PROPERTIES OUTPUT_NAME "ateccx08pkcs11")
@@ -104,7 +106,7 @@ endif()
104106
if(LINUX)
105107
if(HAS_LIBUSB AND ATCA_HAL_KIT_HID)
106108
target_link_libraries(cryptoauth usb-1.0)
107-
elseif(HAS_UDEV AND ATCA_HAL_KIT_HID)
109+
elseif(HAS_LIBUDEV AND ATCA_HAL_KIT_HID)
108110
target_link_libraries(cryptoauth udev)
109111
endif()
110112
target_link_libraries(cryptoauth rt)

python/setup.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def build_extension(self, ext):
147147
try:
148148
subprocess.check_output(['cmake', cmakelist_path] + cmake_args, cwd=os.path.abspath(self.build_temp), stderr=subprocess.STDOUT)
149149
except subprocess.CalledProcessError as e:
150-
msg = e.output.decode('ascii')
150+
msg = e.output.decode('utf-8')
151151
if 'usb' in msg:
152152
msg += '\n\n USB libraries or headers were not located. If USB support is\n' \
153153
' not required it can be disabled by setting the environment\n' \
@@ -156,13 +156,16 @@ def build_extension(self, ext):
156156
' $ export CRYPTOAUTHLIB_NOUSB=True\n\n' \
157157
' Run setup.py clean before trying install again or use the pip \n' \
158158
' option --no-cache-dir\n'
159-
raise Exception(msg)
159+
raise RuntimeError(msg)
160160

161161
# Build the library
162162
try:
163163
subprocess.check_output(['cmake', '--build', '.'] + build_args, cwd=os.path.abspath(self.build_temp), stderr=subprocess.STDOUT)
164164
except subprocess.CalledProcessError as e:
165-
raise Exception(e.output.decode('ascii'))
165+
if sys.version_info[0] <= 2:
166+
raise RuntimeError(e.output) # Python 2 doesn't handle unicode exceptions
167+
else:
168+
raise RuntimeError(e.output.decode('utf-8'))
166169

167170

168171
class CryptoAuthCommandInstall(install):

0 commit comments

Comments
 (0)