mirror of
https://github.com/cmur2/python-bme280.git
synced 2024-12-21 16:54:22 +01:00
module: support Python 3 only
This commit is contained in:
parent
9d88df942a
commit
c5fd84e4b9
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
@ -3,26 +3,21 @@ name: ci
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master, three]
|
branches: [master]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [master, three]
|
branches: [master]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '41 4 * * 4' # weekly on thursday morning
|
- cron: '41 4 * * 4' # weekly on thursday morning
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
matrix:
|
||||||
python-version:
|
python-version:
|
||||||
- '2.7'
|
|
||||||
# Python 3.4 on GHA doesn't work due to fastdiff==0.2.0 failing with:
|
|
||||||
# pkg_resources.DistributionNotFound: The 'setuptools_scm>=1.15.0' distribution was not found and is required by the application
|
|
||||||
#- '3.4'
|
|
||||||
- '3.5'
|
|
||||||
- '3.7'
|
- '3.7'
|
||||||
|
- '3.8'
|
||||||
- '3.9'
|
- '3.9'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
13
.travis.yml
13
.travis.yml
@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
os: linux
|
|
||||||
language: python
|
|
||||||
python:
|
|
||||||
- "3.4"
|
|
||||||
|
|
||||||
install:
|
|
||||||
- pip install poetry==1.0.10
|
|
||||||
- poetry install
|
|
||||||
|
|
||||||
script:
|
|
||||||
- make lint
|
|
||||||
- make test
|
|
@ -52,7 +52,7 @@ FILTER_8 = 0x03
|
|||||||
FILTER_16 = 0x04 # and all higher
|
FILTER_16 = 0x04 # and all higher
|
||||||
|
|
||||||
|
|
||||||
class Bme280(object): # pylint: disable=bad-option-value,useless-object-inheritance
|
class Bme280():
|
||||||
def __init__(self, i2c_bus=1, sensor_address=ADDR):
|
def __init__(self, i2c_bus=1, sensor_address=ADDR):
|
||||||
self.bus = smbus.SMBus(i2c_bus)
|
self.bus = smbus.SMBus(i2c_bus)
|
||||||
self.sensor_address = sensor_address
|
self.sensor_address = sensor_address
|
||||||
@ -179,7 +179,7 @@ class Bme280(object): # pylint: disable=bad-option-value,useless-object-inherit
|
|||||||
for i in range(0xE1, 0xE1 + 7):
|
for i in range(0xE1, 0xE1 + 7):
|
||||||
calibration_regs.append(self.bus.read_byte_data(self.sensor_address, i))
|
calibration_regs.append(self.bus.read_byte_data(self.sensor_address, i))
|
||||||
|
|
||||||
# pylint: disable=bad-whitespace
|
# pylint: disable=bad-option-value,bad-whitespace
|
||||||
|
|
||||||
# reorganize 8-bit words into compensation words (without correct sign)
|
# reorganize 8-bit words into compensation words (without correct sign)
|
||||||
self.digT = []
|
self.digT = []
|
||||||
|
@ -11,7 +11,7 @@ license = "MIT"
|
|||||||
homepage = "https://dev.mycrobase.de/gitea/cn/python-bme280"
|
homepage = "https://dev.mycrobase.de/gitea/cn/python-bme280"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^2.7 || ^3.4"
|
python = "^3.7"
|
||||||
smbus2 = "*"
|
smbus2 = "*"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
|
@ -14,7 +14,7 @@ import bme280 # pylint: disable=wrong-import-position
|
|||||||
|
|
||||||
|
|
||||||
# inspired by https://github.com/adafruit/Adafruit_Python_GPIO/blob/master/Adafruit_GPIO/I2C.py
|
# inspired by https://github.com/adafruit/Adafruit_Python_GPIO/blob/master/Adafruit_GPIO/I2C.py
|
||||||
class MockSMBus(object): # pylint: disable=bad-option-value,useless-object-inheritance
|
class MockSMBus():
|
||||||
def __init__(self, initial_read=None):
|
def __init__(self, initial_read=None):
|
||||||
self._log = []
|
self._log = []
|
||||||
self.initial_read = initial_read or {}
|
self.initial_read = initial_read or {}
|
||||||
|
Loading…
Reference in New Issue
Block a user