Skip to content

Commit

Permalink
Updated to build .whl
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Jun 20, 2018
1 parent 9d7bca1 commit 54ba62c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,2 +1,4 @@
build
.idea
dist
*.egg-info
10 changes: 10 additions & 0 deletions MANIFEST.in
@@ -0,0 +1,10 @@
include Api/core/src/vl53l0x_api_calibration.c
include Api/core/src/vl53l0x_api_core.c
include Api/core/src/vl53l0x_api_ranging.c
include Api/core/src/vl53l0x_api_strings.c
include Api/core/src/vl53l0x_api.c
include platform/src/vl53l0x_platform.c
include python_lib/src/vl53l0x_platform.c
include VL53L0X/VL53L0X.py
include README.md
include setup.py
40 changes: 6 additions & 34 deletions setup.py
@@ -1,33 +1,6 @@
from distutils.core import setup, Extension
from distutils.command.build_ext import build_ext
from setuptools import setup, Extension


# Found this on stack overflow:
# https://stackoverflow.com/questions/4529555/building-a-ctypes-based-c-library-with-distutils
# noinspection PyPep8Naming
class build_ext(build_ext, object):

def build_extension(self, ext):
# noinspection PyAttributeOutsideInit
self._ctypes = isinstance(ext, CTypesExtension)
return super(build_ext,self).build_extension(ext)

def get_export_symbols(self, ext):
if self._ctypes:
return ext.export_symbols
return super(build_ext,self).get_export_symbols(ext)

def get_ext_filename(self, ext_name):
if self._ctypes:
return ext_name + '.so'
return super(build_ext,self).get_ext_filename(ext_name)


class CTypesExtension(Extension):
pass


extension = CTypesExtension(
extension = Extension(
'vl53l0x_python',
define_macros=[],
include_dirs=['.', 'Api/core/inc', 'platform/inc'],
Expand All @@ -41,17 +14,16 @@ class CTypesExtension(Extension):
'platform/src/vl53l0x_platform.c',
'python_lib/vl53l0x_python.c'])

setup(name='VL53L0X_rasp_python',
version='1.0.2',
setup(name='VL53L0X',
version='1.0.4',
description='VL53L0X sensor for raspberry PI/JetsonTX2',
# author='?',
# author_email='?',
url='https://github.com/naisy/VL53L0X_rasp_python',
url='https://github.com/pimoroni/VL53L0X_rasp_python',
long_description='''
VL53L0X sensor for raspberry PI/JetsonTX2.
''',
ext_modules=[extension],
package_dir={'': 'python'},
py_modules=['VL53L0X'],
requires=['smbus' or 'smbus2'],
cmdclass={'build_ext': build_ext})
requires=['smbus' or 'smbus2'])

0 comments on commit 54ba62c

Please sign in to comment.