Skip to content

Commit

Permalink
Fixed some python build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
BenUdall-Microchip committed Jul 30, 2019
1 parent 76ccc87 commit 90591bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.6.4)
cmake_minimum_required(VERSION 3.1.0)
project(cryptoauth)

# Various Options for Build
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand Down
9 changes: 6 additions & 3 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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' \
Expand All @@ -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):
Expand Down

0 comments on commit 90591bb

Please sign in to comment.