Skip to content

Commit

Permalink
Merge branch 'dev' for release 0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Aug 15, 2018
2 parents 83f1262 + 2fbc211 commit 2d0d9ab
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
0.0.2
-----

* Improved search for .so file to pick up arch-specific files

0.0.1
-----

* Initial release
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
15 changes: 15 additions & 0 deletions dist.sh
Original file line number Diff line number Diff line change
@@ -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

19 changes: 12 additions & 7 deletions python/VL53L1X.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from smbus2 import SMBus, i2c_msg
import os
import site
import glob

class VL53L1xError(RuntimeError):
pass
Expand All @@ -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')

Expand Down
6 changes: 2 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down

0 comments on commit 2d0d9ab

Please sign in to comment.