diff --git a/CHANGELOG.txt b/CHANGELOG.txt new file mode 100644 index 0000000..a97601f --- /dev/null +++ b/CHANGELOG.txt @@ -0,0 +1,9 @@ +0.0.2 +----- + +* Improved search for .so file to pick up arch-specific files + +0.0.1 +----- + +* Initial release diff --git a/MANIFEST.in b/MANIFEST.in index b0331bf..5ce4e19 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -11,3 +11,5 @@ include api/core/vl53l1_api_strings.c include api/core/vl53l1_api.c include api/platform/vl53l1_platform.c include python_lib/vl53l1x_python.c +include README.rst +include CHANGELOG.txt diff --git a/dist.sh b/dist.sh new file mode 100755 index 0000000..fc090e2 --- /dev/null +++ b/dist.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +PYTHON_VERSIONS=( + "3.5" + "3.4" + "2.7" +) + +for ((i = 0; i < ${#PYTHON_VERSIONS[@]}; i++)); do + PYTHON_VERSION="${PYTHON_VERSIONS[$i]}" + PYTHON_PATH="/usr/bin/python$PYTHON_VERSION" + printf "Building for Python $PYTHON_VERSION\n" + $PYTHON_PATH setup.py bdist_wheel +done + diff --git a/python/VL53L1X.py b/python/VL53L1X.py index a99d993..760eeed 100644 --- a/python/VL53L1X.py +++ b/python/VL53L1X.py @@ -25,6 +25,7 @@ from smbus2 import SMBus, i2c_msg import os import site +import glob class VL53L1xError(RuntimeError): pass @@ -40,19 +41,23 @@ class VL53L1xDistanceMode: # Load VL53L1X shared lib _POSSIBLE_LIBRARY_LOCATIONS = [os.path.dirname(os.path.realpath(__file__))] + site.getsitepackages() + try: _POSSIBLE_LIBRARY_LOCATIONS += [site.getusersitepackages()] except AttributeError: pass for lib_location in _POSSIBLE_LIBRARY_LOCATIONS: - try: - _TOF_LIBRARY = CDLL(lib_location + "/vl53l1x_python.so") - #print("Using: " + lib_location + "/vl51l1x_python.so") - break - except OSError: - #print(lib_location + "/vl51l1x_python.so not found") - pass + files = glob.glob(lib_location + "/vl53l1x_python*.so") + if len(files) > 0: + lib_file = files[0] + try: + _TOF_LIBRARY = CDLL(lib_file) + #print("Using: " + lib_location + "/vl51l1x_python.so") + break + except OSError: + #print(lib_location + "/vl51l1x_python.so not found") + pass else: raise OSError('Could not find vl53l1x_python.so') diff --git a/setup.py b/setup.py index 662141f..3f92e6b 100644 --- a/setup.py +++ b/setup.py @@ -22,14 +22,12 @@ 'python_lib/vl53l1x_python.c']) setup(name='VL53L1X', - version='0.0.1', + version='0.0.2', description='vl53l1x distance sensor driver for Raspberry Pi', # author='?', # author_email='?', url='https://github.com/pimoroni/vl53l1x-python', - long_description=''' -vl53l1x sensor for Raspberry Pi. -''', + long_description=open('README.md').read() + "\n" + open('CHANGELOG.txt').read(), ext_modules=[extension], package_dir={'': 'python'}, py_modules=['VL53L1X'],