From 3520255b7c37e6de07ed3cedf0296cf859e165c4 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen <paulus@paulusschoutsen.nl> Date: Tue, 8 Sep 2015 19:47:05 -0700 Subject: [PATCH 1/5] Fix setup.py unicode version errors --- setup.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 9e45558d9b7..48d8061f897 100755 --- a/setup.py +++ b/setup.py @@ -1,15 +1,11 @@ import os -import re from setuptools import setup, find_packages +from homeassistant.const import __version__ PACKAGE_NAME = 'homeassistant' HERE = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(HERE, PACKAGE_NAME, 'const.py'), - encoding='utf-8') as fp: - VERSION = re.search( - "__version__ = ['\"]([^']+)['\"]\n", fp.read()).group(1) -DOWNLOAD_URL = \ - 'https://github.com/balloob/home-assistant/archive/{}.zip'.format(VERSION) +DOWNLOAD_URL = ('https://github.com/balloob/home-assistant/archive/' + '{}.zip'.format(__version__)) PACKAGES = find_packages(exclude=['tests', 'tests.*']) + \ ['homeassistant.external', 'homeassistant.external.noop', @@ -29,7 +25,7 @@ REQUIRES = [ setup( name=PACKAGE_NAME, - version=VERSION, + version=__version__, license='MIT License', url='https://home-assistant.io/', download_url=DOWNLOAD_URL, From 326d23de380bdc481484be6dcb469b69cd005b67 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen <paulus@paulusschoutsen.nl> Date: Tue, 8 Sep 2015 19:49:27 -0700 Subject: [PATCH 2/5] Fix pip checking if zip files are installed --- homeassistant/components/modbus.py | 4 ++-- homeassistant/components/sensor/dht.py | 6 ++++-- homeassistant/components/sensor/mysensors.py | 5 +++-- homeassistant/components/sensor/rfxtrx.py | 2 +- homeassistant/components/sensor/temper.py | 5 +++-- homeassistant/components/switch/edimax.py | 4 ++-- homeassistant/components/verisure.py | 6 +++--- homeassistant/components/wink.py | 5 +++-- homeassistant/util/package.py | 7 ++++++- requirements_all.txt | 18 +++++++++--------- 10 files changed, 36 insertions(+), 26 deletions(-) diff --git a/homeassistant/components/modbus.py b/homeassistant/components/modbus.py index 3affeb3efee..844e59ea189 100644 --- a/homeassistant/components/modbus.py +++ b/homeassistant/components/modbus.py @@ -33,8 +33,8 @@ from homeassistant.const import (EVENT_HOMEASSISTANT_START, DOMAIN = "modbus" DEPENDENCIES = [] -REQUIREMENTS = ['https://github.com/bashwork/pymodbus/archive/' + - 'd7fc4f1cc975631e0a9011390e8017f64b612661.zip'] +REQUIREMENTS = ['https://github.com/bashwork/pymodbus/archive/' + 'd7fc4f1cc975631e0a9011390e8017f64b612661.zip#pymodbus==1.2.0'] # Type of network MEDIUM = "type" diff --git a/homeassistant/components/sensor/dht.py b/homeassistant/components/sensor/dht.py index 1c7a2ff11ca..2ce0b12be38 100644 --- a/homeassistant/components/sensor/dht.py +++ b/homeassistant/components/sensor/dht.py @@ -44,8 +44,10 @@ from homeassistant.const import TEMP_FAHRENHEIT from homeassistant.helpers.entity import Entity # update this requirement to upstream as soon as it supports python3 -REQUIREMENTS = ['http://github.com/mala-zaba/Adafruit_Python_DHT/archive/' + - '4101340de8d2457dd194bca1e8d11cbfc237e919.zip'] +REQUIREMENTS = ['http://github.com/mala-zaba/Adafruit_Python_DHT/archive/' + '4101340de8d2457dd194bca1e8d11cbfc237e919.zip' + '#Adafruit_DHT==1.1.0'] + _LOGGER = logging.getLogger(__name__) SENSOR_TYPES = { 'temperature': ['Temperature', ''], diff --git a/homeassistant/components/sensor/mysensors.py b/homeassistant/components/sensor/mysensors.py index e8c9b779c37..60e84059cad 100644 --- a/homeassistant/components/sensor/mysensors.py +++ b/homeassistant/components/sensor/mysensors.py @@ -35,8 +35,9 @@ ATTR_NODE_ID = "node_id" ATTR_CHILD_ID = "child_id" _LOGGER = logging.getLogger(__name__) -REQUIREMENTS = ['https://github.com/theolind/pymysensors/archive/' + - '35b87d880147a34107da0d40cb815d75e6cb4af7.zip'] +REQUIREMENTS = ['https://github.com/theolind/pymysensors/archive/' + '35b87d880147a34107da0d40cb815d75e6cb4af7.zip' + '#pymysensors==0.2'] def setup_platform(hass, config, add_devices, discovery_info=None): diff --git a/homeassistant/components/sensor/rfxtrx.py b/homeassistant/components/sensor/rfxtrx.py index d00f6a0cf84..4cb8a939d5e 100644 --- a/homeassistant/components/sensor/rfxtrx.py +++ b/homeassistant/components/sensor/rfxtrx.py @@ -26,7 +26,7 @@ from homeassistant.const import (TEMP_CELCIUS) from homeassistant.helpers.entity import Entity REQUIREMENTS = ['https://github.com/Danielhiversen/pyRFXtrx/archive/' + - 'ec7a1aaddf8270db6e5da1c13d58c1547effd7cf.zip'] + 'ec7a1aaddf8270db6e5da1c13d58c1547effd7cf.zip#RFXtrx==0.15'] DATA_TYPES = OrderedDict([ ('Temperature', TEMP_CELCIUS), diff --git a/homeassistant/components/sensor/temper.py b/homeassistant/components/sensor/temper.py index 26dba41fb18..c7943f0cc06 100644 --- a/homeassistant/components/sensor/temper.py +++ b/homeassistant/components/sensor/temper.py @@ -17,8 +17,9 @@ from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NAME _LOGGER = logging.getLogger(__name__) -REQUIREMENTS = ['https://github.com/rkabadi/temper-python/archive/' + - '3dbdaf2d87b8db9a3cd6e5585fc704537dd2d09b.zip'] +REQUIREMENTS = ['https://github.com/rkabadi/temper-python/archive/' + '3dbdaf2d87b8db9a3cd6e5585fc704537dd2d09b.zip' + '#temperusb==1.2.3'] # pylint: disable=unused-argument diff --git a/homeassistant/components/switch/edimax.py b/homeassistant/components/switch/edimax.py index 4abe2877987..2f38084ed9d 100644 --- a/homeassistant/components/switch/edimax.py +++ b/homeassistant/components/switch/edimax.py @@ -44,8 +44,8 @@ from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD,\ DEFAULT_USERNAME = 'admin' DEFAULT_PASSWORD = '1234' DEVICE_DEFAULT_NAME = 'Edimax Smart Plug' -REQUIREMENTS = ['https://github.com/rkabadi/pyedimax/archive/' + - '365301ce3ff26129a7910c501ead09ea625f3700.zip'] +REQUIREMENTS = ['https://github.com/rkabadi/pyedimax/archive/' + '365301ce3ff26129a7910c501ead09ea625f3700.zip#pyedimax==0.1'] # setup logger _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/verisure.py b/homeassistant/components/verisure.py index c258e89aa9b..c7bc7c205e8 100644 --- a/homeassistant/components/verisure.py +++ b/homeassistant/components/verisure.py @@ -62,9 +62,9 @@ DISCOVER_SWITCHES = 'verisure.switches' DEPENDENCIES = [] REQUIREMENTS = [ - 'https://github.com/persandstrom/python-verisure/archive/' + - '9873c4527f01b1ba1f72ae60f7f35854390d59be.zip' - ] + 'https://github.com/persandstrom/python-verisure/archive/' + '9873c4527f01b1ba1f72ae60f7f35854390d59be.zip#python-verisure==0.2.6' +] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/wink.py b/homeassistant/components/wink.py index eb2beac508a..8d6a5bc40b8 100644 --- a/homeassistant/components/wink.py +++ b/homeassistant/components/wink.py @@ -16,8 +16,9 @@ from homeassistant.const import ( DOMAIN = "wink" DEPENDENCIES = [] -REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/' + - 'c2b700e8ca866159566ecf5e644d9c297f69f257.zip'] +REQUIREMENTS = ['https://github.com/balloob/python-wink/archive/' + 'c2b700e8ca866159566ecf5e644d9c297f69f257.zip' + '#python-wink==0.1'] DISCOVER_LIGHTS = "wink.lights" DISCOVER_SWITCHES = "wink.switches" diff --git a/homeassistant/util/package.py b/homeassistant/util/package.py index 3eccc06e59a..5d32c087efe 100644 --- a/homeassistant/util/package.py +++ b/homeassistant/util/package.py @@ -5,6 +5,7 @@ import pkg_resources import subprocess import sys import threading +from urllib.parse import urlparse _LOGGER = logging.getLogger(__name__) INSTALL_LOCK = threading.Lock() @@ -36,7 +37,11 @@ def check_package_exists(package, target=None): """Check if a package exists. Returns True when the requirement is met. Returns False when the package is not installed or doesn't meet req.""" - req = pkg_resources.Requirement.parse(package) + try: + req = pkg_resources.Requirement.parse(package) + except ValueError: + # This is a zip file + req = pkg_resources.Requirement.parse(urlparse(package).fragment) if target: work_set = pkg_resources.WorkingSet([target]) diff --git a/requirements_all.txt b/requirements_all.txt index 0a71552b2c4..f03b763f00f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -77,10 +77,10 @@ python-forecastio==1.3.3 PyMata==2.07a # Rfxtrx sensor (sensor.rfxtrx) -https://github.com/Danielhiversen/pyRFXtrx/archive/ec7a1aaddf8270db6e5da1c13d58c1547effd7cf.zip +https://github.com/Danielhiversen/pyRFXtrx/archive/ec7a1aaddf8270db6e5da1c13d58c1547effd7cf.zip#RFXtrx==0.15 # Mysensors -https://github.com/theolind/pymysensors/archive/35b87d880147a34107da0d40cb815d75e6cb4af7.zip +https://github.com/theolind/pymysensors/archive/35b87d880147a34107da0d40cb815d75e6cb4af7.zip#pymysensors==0.2 # Netgear (device_tracker.netgear) pynetgear==0.3 @@ -92,33 +92,33 @@ netdisco==0.3 pywemo==0.3 # Wink (*.wink) -https://github.com/balloob/python-wink/archive/c2b700e8ca866159566ecf5e644d9c297f69f257.zip +https://github.com/balloob/python-wink/archive/c2b700e8ca866159566ecf5e644d9c297f69f257.zip#python-wink==0.1 # Slack notifier (notify.slack) slacker==0.6.8 # Temper sensors (sensor.temper) -https://github.com/rkabadi/temper-python/archive/3dbdaf2d87b8db9a3cd6e5585fc704537dd2d09b.zip +https://github.com/rkabadi/temper-python/archive/3dbdaf2d87b8db9a3cd6e5585fc704537dd2d09b.zip#temperusb==1.2.3 # PyEdimax -https://github.com/rkabadi/pyedimax/archive/365301ce3ff26129a7910c501ead09ea625f3700.zip +https://github.com/rkabadi/pyedimax/archive/365301ce3ff26129a7910c501ead09ea625f3700.zip#pyedimax==0.1 # RPI-GPIO platform (*.rpi_gpio) # Uncomment for Raspberry Pi -# RPi.GPIO ==0.5.11 +# RPi.GPIO==0.5.11 # Adafruit temperature/humidity sensor # uncomment on a Raspberry Pi / Beaglebone -# http://github.com/mala-zaba/Adafruit_Python_DHT/archive/4101340de8d2457dd194bca1e8d11cbfc237e919.zip +# http://github.com/mala-zaba/Adafruit_Python_DHT/archive/4101340de8d2457dd194bca1e8d11cbfc237e919.zip#Adafruit_DHT==1.1.0 # PAHO MQTT Binding (mqtt) paho-mqtt==1.1 # PyModbus (modbus) -https://github.com/bashwork/pymodbus/archive/d7fc4f1cc975631e0a9011390e8017f64b612661.zip +https://github.com/bashwork/pymodbus/archive/d7fc4f1cc975631e0a9011390e8017f64b612661.zip#pymodbus==1.2.0 # Verisure (verisure) -https://github.com/persandstrom/python-verisure/archive/9873c4527f01b1ba1f72ae60f7f35854390d59be.zip +https://github.com/persandstrom/python-verisure/archive/9873c4527f01b1ba1f72ae60f7f35854390d59be.zip#python-verisure==0.2.6 # Python tools for interacting with IFTTT Maker Channel (ifttt) pyfttt==0.3 From c68ee2dd0f99b9efdf939a443a30e4ad36ae22fe Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen <paulus@paulusschoutsen.nl> Date: Tue, 8 Sep 2015 19:49:51 -0700 Subject: [PATCH 3/5] Change dev version to adhere Python versioning --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 1e1d7161599..539043bf61e 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,6 +1,6 @@ """ Constants used by Home Assistant components. """ -__version__ = "0.7.2-pre" +__version__ = "0.7.2rc0" # Can be used to specify a catch all when registering state or event listeners. MATCH_ALL = '*' From 89bdead44c27c8e36f9b52a2dccc01a0f25cc74c Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen <paulus@paulusschoutsen.nl> Date: Tue, 8 Sep 2015 20:11:25 -0700 Subject: [PATCH 4/5] Remove latest git submodules --- .gitmodules | 9 --------- homeassistant/components/light/vera.py | 7 +++++-- homeassistant/components/sensor/sabnzbd.py | 10 +++++++--- homeassistant/components/sensor/vera.py | 7 +++++-- homeassistant/components/switch/vera.py | 7 +++++-- homeassistant/external/noop | 1 - homeassistant/external/nzbclients | 1 - homeassistant/external/vera | 1 - requirements_all.txt | 8 ++++++++ 9 files changed, 30 insertions(+), 21 deletions(-) delete mode 160000 homeassistant/external/noop delete mode 160000 homeassistant/external/nzbclients delete mode 160000 homeassistant/external/vera diff --git a/.gitmodules b/.gitmodules index a627e522d8f..ad28a4e2c8a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,12 +1,3 @@ -[submodule "homeassistant/external/noop"] - path = homeassistant/external/noop - url = https://github.com/balloob/noop.git -[submodule "homeassistant/external/vera"] - path = homeassistant/external/vera - url = https://github.com/jamespcole/home-assistant-vera-api.git -[submodule "homeassistant/external/nzbclients"] - path = homeassistant/external/nzbclients - url = https://github.com/jamespcole/home-assistant-nzb-clients.git [submodule "homeassistant/components/frontend/www_static/home-assistant-polymer"] path = homeassistant/components/frontend/www_static/home-assistant-polymer url = https://github.com/balloob/home-assistant-polymer.git diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index ab52905308b..f41bfb56685 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -51,8 +51,10 @@ it should be set to "true" if you want this device excluded. import logging from requests.exceptions import RequestException from homeassistant.components.switch.vera import VeraSwitch -# pylint: disable=no-name-in-module, import-error -import homeassistant.external.vera.vera as veraApi + +REQUIREMENTS = ['https://github.com/balloob/home-assistant-vera-api/archive/' + 'a8f823066ead6c7da6fb5e7abaf16fef62e63364.zip' + '#python-vera==0.1'] _LOGGER = logging.getLogger(__name__) @@ -60,6 +62,7 @@ _LOGGER = logging.getLogger(__name__) # pylint: disable=unused-argument def setup_platform(hass, config, add_devices_callback, discovery_info=None): """ Find and return Vera lights. """ + import pyvera as veraApi base_url = config.get('vera_controller_url') if not base_url: diff --git a/homeassistant/components/sensor/sabnzbd.py b/homeassistant/components/sensor/sabnzbd.py index 89110f7a71d..319ba1c8b53 100644 --- a/homeassistant/components/sensor/sabnzbd.py +++ b/homeassistant/components/sensor/sabnzbd.py @@ -47,12 +47,13 @@ from homeassistant.util import Throttle from datetime import timedelta from homeassistant.helpers.entity import Entity -# pylint: disable=no-name-in-module, import-error -from homeassistant.external.nzbclients.sabnzbd import SabnzbdApi -from homeassistant.external.nzbclients.sabnzbd import SabnzbdApiException import logging +REQUIREMENTS = ['https://github.com/jamespcole/home-assistant-nzb-clients/' + 'archive/616cad59154092599278661af17e2a9f2cf5e2a9.zip' + '#python-sabnzbd==0.1'] + SENSOR_TYPES = { 'current_status': ['Status', ''], 'speed': ['Speed', 'MB/s'], @@ -70,6 +71,8 @@ _THROTTLED_REFRESH = None # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the SABnzbd sensors. """ + from SabnzbdApiException import SabnzbdApi, SabnzbdApiException + api_key = config.get("api_key") base_url = config.get("base_url") name = config.get("name", "SABnzbd") @@ -130,6 +133,7 @@ class SabnzbdSensor(Entity): def refresh_sabnzbd_data(self): """ Calls the throttled SABnzbd refresh method. """ if _THROTTLED_REFRESH is not None: + from SabnzbdApiException import SabnzbdApiException try: _THROTTLED_REFRESH() except SabnzbdApiException: diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index 47748af637e..b02e3acdea0 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -54,8 +54,10 @@ from homeassistant.helpers.entity import Entity from homeassistant.const import ( ATTR_BATTERY_LEVEL, ATTR_TRIPPED, ATTR_ARMED, ATTR_LAST_TRIP_TIME, TEMP_CELCIUS, TEMP_FAHRENHEIT) -# pylint: disable=no-name-in-module, import-error -import homeassistant.external.vera.vera as veraApi + +REQUIREMENTS = ['https://github.com/balloob/home-assistant-vera-api/archive/' + 'a8f823066ead6c7da6fb5e7abaf16fef62e63364.zip' + '#python-vera==0.1'] _LOGGER = logging.getLogger(__name__) @@ -63,6 +65,7 @@ _LOGGER = logging.getLogger(__name__) # pylint: disable=unused-argument def get_devices(hass, config): """ Find and return Vera Sensors. """ + import pyvera as veraApi base_url = config.get('vera_controller_url') if not base_url: diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index e568596a0b2..bb7f43522f4 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -52,8 +52,10 @@ import homeassistant.util.dt as dt_util from homeassistant.helpers.entity import ToggleEntity from homeassistant.const import ( ATTR_BATTERY_LEVEL, ATTR_TRIPPED, ATTR_ARMED, ATTR_LAST_TRIP_TIME) -# pylint: disable=no-name-in-module, import-error -import homeassistant.external.vera.vera as veraApi + +REQUIREMENTS = ['https://github.com/balloob/home-assistant-vera-api/archive/' + 'a8f823066ead6c7da6fb5e7abaf16fef62e63364.zip' + '#python-vera==0.1'] _LOGGER = logging.getLogger(__name__) @@ -61,6 +63,7 @@ _LOGGER = logging.getLogger(__name__) # pylint: disable=unused-argument def get_devices(hass, config): """ Find and return Vera switches. """ + import pyvera as veraApi base_url = config.get('vera_controller_url') if not base_url: diff --git a/homeassistant/external/noop b/homeassistant/external/noop deleted file mode 160000 index 4eaeb3367f9..00000000000 --- a/homeassistant/external/noop +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4eaeb3367f9ada05dae3319cf24ab1da5de1aa89 diff --git a/homeassistant/external/nzbclients b/homeassistant/external/nzbclients deleted file mode 160000 index f01997498fe..00000000000 --- a/homeassistant/external/nzbclients +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f01997498fe190d6ac2a2c375a739024843bd44d diff --git a/homeassistant/external/vera b/homeassistant/external/vera deleted file mode 160000 index 30c59781d63..00000000000 --- a/homeassistant/external/vera +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 30c59781d63322db2160ff00a4b99f16ead40b85 diff --git a/requirements_all.txt b/requirements_all.txt index f03b763f00f..f44b14d9ba7 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -122,3 +122,11 @@ https://github.com/persandstrom/python-verisure/archive/9873c4527f01b1ba1f72ae60 # Python tools for interacting with IFTTT Maker Channel (ifttt) pyfttt==0.3 + +# sensor.sabnzbd +https://github.com/balloob/home-assistant-nzb-clients/archive/616cad59154092599278661af17e2a9f2cf5e2a9.zip#python-sabnzbd==0.1 + +# switch.vera +# sensor.vera +# light.vera +https://github.com/balloob/home-assistant-vera-api/archive/a8f823066ead6c7da6fb5e7abaf16fef62e63364.zip#python-vera==0.1 From dd23a0b3ebd096c6a6d61f30a901ccec98ca9304 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen <paulus@paulusschoutsen.nl> Date: Tue, 8 Sep 2015 20:22:13 -0700 Subject: [PATCH 5/5] Fix sabnzbd imports --- homeassistant/components/sensor/sabnzbd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/sensor/sabnzbd.py b/homeassistant/components/sensor/sabnzbd.py index 319ba1c8b53..b372e777478 100644 --- a/homeassistant/components/sensor/sabnzbd.py +++ b/homeassistant/components/sensor/sabnzbd.py @@ -71,7 +71,7 @@ _THROTTLED_REFRESH = None # pylint: disable=unused-argument def setup_platform(hass, config, add_devices, discovery_info=None): """ Sets up the SABnzbd sensors. """ - from SabnzbdApiException import SabnzbdApi, SabnzbdApiException + from pysabnzbd import SabnzbdApi, SabnzbdApiException api_key = config.get("api_key") base_url = config.get("base_url") @@ -133,7 +133,7 @@ class SabnzbdSensor(Entity): def refresh_sabnzbd_data(self): """ Calls the throttled SABnzbd refresh method. """ if _THROTTLED_REFRESH is not None: - from SabnzbdApiException import SabnzbdApiException + from pysabnzbd import SabnzbdApiException try: _THROTTLED_REFRESH() except SabnzbdApiException: