mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Block dependencies that depend on enum34 (#8698)
* Block dependencies that depend on enum34 * Remove uninstalling enum34 * Update validation script * Add constraints to tox.ini * Upgrade yeelight to version that uses enum-compat * Disable sensor.skybeacon * Lint
This commit is contained in:
parent
a0530d8b9c
commit
e49b970665
@ -29,8 +29,7 @@ COPY requirements_all.txt requirements_all.txt
|
||||
# Uninstall enum34 because some depenndecies install it but breaks Python 3.4+.
|
||||
# See PR #8103 for more info.
|
||||
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
|
||||
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop cchardet && \
|
||||
pip3 uninstall -y enum34
|
||||
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop cchardet
|
||||
|
||||
# Copy source
|
||||
COPY . .
|
||||
|
@ -22,7 +22,7 @@ from homeassistant.components.light import (
|
||||
Light, PLATFORM_SCHEMA)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
REQUIREMENTS = ['yeelight==0.3.0']
|
||||
REQUIREMENTS = ['yeelight==0.3.2']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -16,7 +16,7 @@ from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_NAME, CONF_MAC, TEMP_CELSIUS, STATE_UNKNOWN, EVENT_HOMEASSISTANT_STOP)
|
||||
|
||||
REQUIREMENTS = ['pygatt==3.1.1']
|
||||
# REQUIREMENTS = ['pygatt==3.1.1']
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -39,6 +39,10 @@ CONNECT_TIMEOUT = 30
|
||||
# pylint: disable=unused-argument
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Set up the Skybeacon sensor."""
|
||||
_LOGGER.warning("This platform has been disabled due to having a "
|
||||
"requirement depending on enum34.")
|
||||
return
|
||||
# pylint: disable=unreachable
|
||||
name = config.get(CONF_NAME)
|
||||
mac = config.get(CONF_MAC)
|
||||
_LOGGER.debug("Setting up...")
|
||||
@ -136,6 +140,7 @@ class Monitor(threading.Thread):
|
||||
|
||||
def run(self):
|
||||
"""Thread that keeps connection alive."""
|
||||
# pylint: disable=import-error
|
||||
import pygatt
|
||||
from pygatt.backends import Characteristic
|
||||
from pygatt.exceptions import (
|
||||
|
@ -9,3 +9,6 @@ aiohttp==2.2.4
|
||||
async_timeout==1.2.1
|
||||
chardet==3.0.4
|
||||
astral==1.4
|
||||
|
||||
# Breaks Python 3.6 and is not needed for our supported Pythons
|
||||
enum34==1000000000.0.0
|
||||
|
@ -584,9 +584,6 @@ pyfoscam==1.2
|
||||
# homeassistant.components.ifttt
|
||||
pyfttt==0.3
|
||||
|
||||
# homeassistant.components.sensor.skybeacon
|
||||
pygatt==3.1.1
|
||||
|
||||
# homeassistant.components.remote.harmony
|
||||
pyharmony==1.0.16
|
||||
|
||||
@ -983,7 +980,7 @@ yahoo-finance==1.4.0
|
||||
yahooweather==0.8
|
||||
|
||||
# homeassistant.components.light.yeelight
|
||||
yeelight==0.3.0
|
||||
yeelight==0.3.2
|
||||
|
||||
# homeassistant.components.light.yeelightsunflower
|
||||
yeelightsunflower==0.0.8
|
||||
|
@ -88,6 +88,10 @@ URL_PIN = ('https://home-assistant.io/developers/code_review_platform/'
|
||||
|
||||
CONSTRAINT_PATH = os.path.join(os.path.dirname(__file__),
|
||||
'../homeassistant/package_constraints.txt')
|
||||
CONSTRAINT_BASE = """
|
||||
# Breaks Python 3.6 and is not needed for our supported Pythons
|
||||
enum34==1000000000.0.0
|
||||
"""
|
||||
|
||||
|
||||
def explore_module(package, explore_children):
|
||||
@ -223,25 +227,25 @@ def write_test_requirements_file(data):
|
||||
def write_constraints_file(data):
|
||||
"""Write constraints to a file."""
|
||||
with open(CONSTRAINT_PATH, 'w+', newline="\n") as req_file:
|
||||
req_file.write(data)
|
||||
req_file.write(data + CONSTRAINT_BASE)
|
||||
|
||||
|
||||
def validate_requirements_file(data):
|
||||
"""Validate if requirements_all.txt is up to date."""
|
||||
with open('requirements_all.txt', 'r') as req_file:
|
||||
return data == ''.join(req_file)
|
||||
return data == req_file.read()
|
||||
|
||||
|
||||
def validate_requirements_test_file(data):
|
||||
"""Validate if requirements_all.txt is up to date."""
|
||||
with open('requirements_test_all.txt', 'r') as req_file:
|
||||
return data == ''.join(req_file)
|
||||
return data == req_file.read()
|
||||
|
||||
|
||||
def validate_constraints_file(data):
|
||||
"""Validate if constraints is up to date."""
|
||||
with open(CONSTRAINT_PATH, 'r') as req_file:
|
||||
return data == ''.join(req_file)
|
||||
return data + CONSTRAINT_BASE == req_file.read()
|
||||
|
||||
|
||||
def main():
|
||||
|
2
tox.ini
2
tox.ini
@ -15,6 +15,7 @@ commands =
|
||||
py.test --timeout=30 --duration=10 --cov --cov-report= {posargs}
|
||||
deps =
|
||||
-r{toxinidir}/requirements_test_all.txt
|
||||
-c{toxinidir}/homeassistant/package_constraints.txt
|
||||
|
||||
[testenv:lint]
|
||||
basepython = python3
|
||||
@ -22,6 +23,7 @@ ignore_errors = True
|
||||
deps =
|
||||
-r{toxinidir}/requirements_all.txt
|
||||
-r{toxinidir}/requirements_test.txt
|
||||
-c{toxinidir}/homeassistant/package_constraints.txt
|
||||
commands =
|
||||
flake8
|
||||
pylint homeassistant
|
||||
|
@ -29,8 +29,7 @@ COPY requirements_all.txt requirements_all.txt
|
||||
# Uninstall enum34 because some depenndecies install it but breaks Python 3.4+.
|
||||
# See PR #8103 for more info.
|
||||
RUN pip3 install --no-cache-dir -r requirements_all.txt && \
|
||||
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop cchardet && \
|
||||
pip3 uninstall -y enum34
|
||||
pip3 install --no-cache-dir mysqlclient psycopg2 uvloop cchardet
|
||||
|
||||
# BEGIN: Development additions
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user