From 91bb131713322486cf06182bd004a1e17ad96382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20S=C3=B8borg?= Date: Fri, 29 May 2020 15:35:54 +0000 Subject: [PATCH 1/6] Add dependency: smbus2 Fixes: ```python >>> import bme680 >>> sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/dist-packages/bme680/__init__.py", line 22, in __init__ import smbus ModuleNotFoundError: No module named 'smbus' ``` --- library/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/setup.py b/library/setup.py index f40026b..3e0c0c9 100755 --- a/library/setup.py +++ b/library/setup.py @@ -50,5 +50,5 @@ setup( classifiers=classifiers, packages=['bme680'], py_modules=[], - install_requires=[] + install_requires=['smbus2'] ) From 056049ee038c218037332def39e8c93b33e374af Mon Sep 17 00:00:00 2001 From: Melvin Campos Casares Date: Wed, 21 Oct 2020 19:07:20 +0200 Subject: [PATCH 2/6] Fix TypeError preventing script to launch TypeError: argument should be integer or bytes-like object, not 'str' --- examples/compensated-temperature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/compensated-temperature.py b/examples/compensated-temperature.py index 071bbfb..55fad34 100755 --- a/examples/compensated-temperature.py +++ b/examples/compensated-temperature.py @@ -32,7 +32,7 @@ sensor.set_filter(bme680.FILTER_SIZE_3) def get_cpu_temperature(): process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE) output, _error = process.communicate() - return float(output[output.index('=') + 1:output.rindex("'")]) + return float(output[output.index(ord('=')) + 1:output.rindex(ord("'"))]) factor = 1.0 # Smaller numbers adjust temp down, vice versa From 02ca7a435310b650ba9aa6fe0c4cbd2622760bad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20S=C3=B8borg?= Date: Sun, 1 Nov 2020 01:11:16 +0000 Subject: [PATCH 3/6] Update dependency requirement If anyone is reading the file they will know to install `python3-smbus`, but if someone just do a quick `pip3 install bme680` then make sure to pull smbus from PyPI --- library/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/setup.py b/library/setup.py index 3e0c0c9..996822e 100755 --- a/library/setup.py +++ b/library/setup.py @@ -50,5 +50,5 @@ setup( classifiers=classifiers, packages=['bme680'], py_modules=[], - install_requires=['smbus2'] + install_requires=['smbus'] # preferably: install `python3-smbus` instead of relying on this ) From d7f712247a0dd732b000071b45287faa2f5cd5e5 Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Mon, 2 Nov 2020 15:58:50 +0000 Subject: [PATCH 4/6] Swap from ord() to bytes --- examples/compensated-temperature.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/compensated-temperature.py b/examples/compensated-temperature.py index 55fad34..53e72a5 100755 --- a/examples/compensated-temperature.py +++ b/examples/compensated-temperature.py @@ -32,7 +32,7 @@ sensor.set_filter(bme680.FILTER_SIZE_3) def get_cpu_temperature(): process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE) output, _error = process.communicate() - return float(output[output.index(ord('=')) + 1:output.rindex(ord("'"))]) + return float(output[output.index(b'=') + 1:output.rindex(b"'")]) factor = 1.0 # Smaller numbers adjust temp down, vice versa From 9855b109692d6ce73aba6bd20737c9735a4830ce Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Sat, 14 Nov 2020 10:57:49 +0000 Subject: [PATCH 5/6] Add GitHub actions workflow --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d8187f0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Python Tests + +on: + pull_request: + push: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python: [2.7, 3.4, 3.5, 3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install Dependencies + run: | + python -m pip install --upgrade setuptools tox + - name: Run Tests + working-directory: library + run: | + tox -e py + - name: Coverage + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + working-directory: library + run: | + python -m pip install coveralls + coveralls + if: ${{ matrix.python == '3.8' }} + From 191dc9e115b4b65899112771f58e47d28996025c Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Sat, 14 Nov 2020 11:00:21 +0000 Subject: [PATCH 6/6] Remove .travis.yml --- .travis.yml | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 42479fe..0000000 --- a/.travis.yml +++ /dev/null @@ -1,24 +0,0 @@ -language: python -sudo: false -cache: pip - -git: - submodules: true - -matrix: - include: - - python: "2.7" - env: TOXENV=py27 - - python: "3.5" - env: TOXENV=py35 - - python: "2.7" - env: TOXENV=py27 - -install: - - pip install --ignore-installed --upgrade setuptools pip tox coveralls - -script: - - cd library - - tox -vv - -after_success: if [ "$TOXENV" == "py35" ]; then coveralls; fi