From 326d23de380bdc481484be6dcb469b69cd005b67 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 8 Sep 2015 19:49:27 -0700 Subject: [PATCH] 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