[arch-commits] Commit in home-assistant/trunk (3 files)

Maxime Gauduin alucryd at archlinux.org
Fri May 7 10:29:52 UTC 2021


    Date: Friday, May 7, 2021 @ 10:29:51
  Author: alucryd
Revision: 928588

home-assistant 2021.5.0-1: switch to python-sqlalchemy1.3

Modified:
  home-assistant/trunk/PKGBUILD
  home-assistant/trunk/home-assistant.service
Deleted:
  home-assistant/trunk/home-assistant-astral2.2.patch

--------------------------------+
 PKGBUILD                       |   11 -
 home-assistant-astral2.2.patch |  290 ---------------------------------------
 home-assistant.service         |    2 
 3 files changed, 6 insertions(+), 297 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-05-07 10:23:57 UTC (rev 928587)
+++ PKGBUILD	2021-05-07 10:29:51 UTC (rev 928588)
@@ -6,7 +6,7 @@
 
 pkgname=home-assistant
 pkgdesc='Open source home automation that puts local control and privacy first'
-pkgver=2021.4.6
+pkgver=2021.5.0
 pkgrel=1
 arch=(any)
 url=https://home-assistant.io/
@@ -34,7 +34,7 @@
   python-requests
   python-ruamel-yaml
   python-slugify
-  python-sqlalchemy
+  python-sqlalchemy1.3
   python-voluptuous
   python-voluptuous-serialize
   python-yaml
@@ -51,15 +51,13 @@
   'python-dtlssocket: Ikea Tradfri integration'
   'python-lxml: Meteo France integration'
 )
-_tag=5ee373869a59266142001b62a5067d56c22bfddf
+_tag=ccf92e4721bf7c39c11c0239b81252342a244a35
 source=(
   git+https://github.com/home-assistant/home-assistant.git#tag=${_tag}
   home-assistant.service
-  home-assistant-astral2.2.patch
 )
 b2sums=('SKIP'
-        '0df7bbfdac09e37294ac27567e677855c72d13be3aefbd23e0a8f101cf2148302affbe9b6b586b893f77fc990f665d7b95f4916583680c06abd8f74b5cdf3da9'
-        '4458692cb10e0832c1b321b96d74d7dd7e5e0e9e9b23d420efec9e27e5b0f34ef33f64789b05fbc5ec49337002ad26b026079b939741bbf16869c52c9316ef34')
+        'c56b88e4d8d6d10ea132d22916468109ffaa83c1176a75e0c0ead16b261c34fe4c279cec6dca415b1addfcd873ad35b294f60a3e1ba62cc917a9dbb73cce47d4')
 
 pkgver() {
   cd home-assistant
@@ -68,7 +66,6 @@
 
 prepare() {
   cd home-assistant
-  patch -Np1 -i ../home-assistant-astral2.2.patch
   # lift hard dep constraints, we'll deal with breaking changes ourselves
   sed 's/==/>=/g' -i requirements.txt setup.py homeassistant/package_constraints.txt
   # allow pip >= 20.3 to be used

Deleted: home-assistant-astral2.2.patch
===================================================================
--- home-assistant-astral2.2.patch	2021-05-07 10:23:57 UTC (rev 928587)
+++ home-assistant-astral2.2.patch	2021-05-07 10:29:51 UTC (rev 928588)
@@ -1,290 +0,0 @@
-From a96a731fb1a2814f88e574a266b051f401d8a262 Mon Sep 17 00:00:00 2001
-From: Maxime Gauduin <alucryd at gmail.com>
-Date: Wed, 14 Apr 2021 08:40:16 +0200
-Subject: [PATCH] bump astral to 2.2
-
----
- homeassistant/components/moon/sensor.py  |  5 +--
- homeassistant/components/sun/__init__.py | 20 +++++-----
- homeassistant/helpers/sun.py             | 50 +++++++++++++++---------
- homeassistant/package_constraints.txt    |  2 +-
- requirements.txt                         |  2 +-
- setup.py                                 |  2 +-
- 6 files changed, 47 insertions(+), 34 deletions(-)
-
-diff --git a/homeassistant/components/moon/sensor.py b/homeassistant/components/moon/sensor.py
-index 4b373469cc..6213e218d2 100644
---- a/homeassistant/components/moon/sensor.py
-+++ b/homeassistant/components/moon/sensor.py
-@@ -1,5 +1,5 @@
- """Support for tracking the moon phases."""
--from astral import Astral
-+from astral import moon
- import voluptuous as vol
- 
- from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
-@@ -48,7 +48,6 @@ class MoonSensor(SensorEntity):
-         """Initialize the moon sensor."""
-         self._name = name
-         self._state = None
--        self._astral = Astral()
- 
-     @property
-     def name(self):
-@@ -87,4 +86,4 @@ class MoonSensor(SensorEntity):
-     async def async_update(self):
-         """Get the time and updates the states."""
-         today = dt_util.as_local(dt_util.utcnow()).date()
--        self._state = self._astral.moon_phase(today)
-+        self._state = moon.phase(today)
-diff --git a/homeassistant/components/sun/__init__.py b/homeassistant/components/sun/__init__.py
-index dfe3b15c11..489eab6b5b 100644
---- a/homeassistant/components/sun/__init__.py
-+++ b/homeassistant/components/sun/__init__.py
-@@ -92,6 +92,7 @@ class Sun(Entity):
-         """Initialize the sun."""
-         self.hass = hass
-         self.location = None
-+        self.elevation = 0.0
-         self._state = self.next_rising = self.next_setting = None
-         self.next_dawn = self.next_dusk = None
-         self.next_midnight = self.next_noon = None
-@@ -100,10 +101,11 @@ class Sun(Entity):
-         self._next_change = None
- 
-         def update_location(_event):
--            location = get_astral_location(self.hass)
-+            location, elevation = get_astral_location(self.hass)
-             if location == self.location:
-                 return
-             self.location = location
-+            self.elevation = elevation
-             self.update_events()
- 
-         update_location(None)
-@@ -140,7 +142,7 @@ class Sun(Entity):
- 
-     def _check_event(self, utc_point_in_time, sun_event, before):
-         next_utc = get_location_astral_event_next(
--            self.location, sun_event, utc_point_in_time
-+            self.location, self.elevation, sun_event, utc_point_in_time
-         )
-         if next_utc < self._next_change:
-             self._next_change = next_utc
-@@ -169,7 +171,7 @@ class Sun(Entity):
-         )
-         self.location.solar_depression = -10
-         self._check_event(utc_point_in_time, "dawn", PHASE_SMALL_DAY)
--        self.next_noon = self._check_event(utc_point_in_time, "solar_noon", None)
-+        self.next_noon = self._check_event(utc_point_in_time, "noon", None)
-         self._check_event(utc_point_in_time, "dusk", PHASE_DAY)
-         self.next_setting = self._check_event(
-             utc_point_in_time, SUN_EVENT_SUNSET, PHASE_SMALL_DAY
-@@ -180,9 +182,7 @@ class Sun(Entity):
-         self._check_event(utc_point_in_time, "dusk", PHASE_NAUTICAL_TWILIGHT)
-         self.location.solar_depression = "astronomical"
-         self._check_event(utc_point_in_time, "dusk", PHASE_ASTRONOMICAL_TWILIGHT)
--        self.next_midnight = self._check_event(
--            utc_point_in_time, "solar_midnight", None
--        )
-+        self.next_midnight = self._check_event(utc_point_in_time, "midnight", None)
-         self.location.solar_depression = "civil"
- 
-         # if the event was solar midday or midnight, phase will now
-@@ -190,7 +190,7 @@ class Sun(Entity):
-         # even in the day at the poles, so we can't rely on it.
-         # Need to calculate phase if next is noon or midnight
-         if self.phase is None:
--            elevation = self.location.solar_elevation(self._next_change)
-+            elevation = self.location.solar_elevation(self._next_change, self.elevation)
-             if elevation >= 10:
-                 self.phase = PHASE_DAY
-             elif elevation >= 0:
-@@ -222,9 +222,11 @@ class Sun(Entity):
-         """Calculate the position of the sun."""
-         # Grab current time in case system clock changed since last time we ran.
-         utc_point_in_time = dt_util.utcnow()
--        self.solar_azimuth = round(self.location.solar_azimuth(utc_point_in_time), 2)
-+        self.solar_azimuth = round(
-+            self.location.solar_azimuth(utc_point_in_time, self.elevation), 2
-+        )
-         self.solar_elevation = round(
--            self.location.solar_elevation(utc_point_in_time), 2
-+            self.location.solar_elevation(utc_point_in_time, self.elevation), 2
-         )
- 
-         _LOGGER.debug(
-diff --git a/homeassistant/helpers/sun.py b/homeassistant/helpers/sun.py
-index b3a37d238f..b5bac8d71b 100644
---- a/homeassistant/helpers/sun.py
-+++ b/homeassistant/helpers/sun.py
-@@ -2,7 +2,7 @@
- from __future__ import annotations
- 
- import datetime
--from typing import TYPE_CHECKING
-+from typing import TYPE_CHECKING, Optional, Tuple, Union
- 
- from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET
- from homeassistant.core import HomeAssistant, callback
-@@ -14,27 +14,32 @@ if TYPE_CHECKING:
- 
- DATA_LOCATION_CACHE = "astral_location_cache"
- 
-+ELEVATION_AGNOSTIC_EVENTS = ("noon", "midnight")
-+
- 
- @callback
- @bind_hass
--def get_astral_location(hass: HomeAssistant) -> astral.Location:
-+def get_astral_location(
-+    hass: HomeAssistant,
-+) -> Tuple["astral.location.Location", "astral.Elevation"]:
-     """Get an astral location for the current Home Assistant configuration."""
--    from astral import Location  # pylint: disable=import-outside-toplevel
-+    from astral import LocationInfo # pylint: disable=import-outside-toplevel
-+    from astral.location import Location # pylint: disable=import-outside-toplevel
- 
-+    timezone = str(hass.config.time_zone)
-     latitude = hass.config.latitude
-     longitude = hass.config.longitude
--    timezone = str(hass.config.time_zone)
-     elevation = hass.config.elevation
--    info = ("", "", latitude, longitude, timezone, elevation)
-+    info = ("", "", timezone, latitude, longitude)
- 
-     # Cache astral locations so they aren't recreated with the same args
-     if DATA_LOCATION_CACHE not in hass.data:
-         hass.data[DATA_LOCATION_CACHE] = {}
- 
-     if info not in hass.data[DATA_LOCATION_CACHE]:
--        hass.data[DATA_LOCATION_CACHE][info] = Location(info)
-+        hass.data[DATA_LOCATION_CACHE][info] = Location(LocationInfo(*info))
- 
--    return hass.data[DATA_LOCATION_CACHE][info]
-+    return hass.data[DATA_LOCATION_CACHE][info], elevation
- 
- 
- @callback
-@@ -46,26 +51,31 @@ def get_astral_event_next(
-     offset: datetime.timedelta | None = None,
- ) -> datetime.datetime:
-     """Calculate the next specified solar event."""
--    location = get_astral_location(hass)
--    return get_location_astral_event_next(location, event, utc_point_in_time, offset)
-+    location, elevation = get_astral_location(hass)
-+    return get_location_astral_event_next(
-+        location, elevation, event, utc_point_in_time, offset
-+    )
- 
- 
- @callback
- def get_location_astral_event_next(
--    location: astral.Location,
-+    location: "astral.location.Location",
-+    elevation: "astral.Elevation",
-     event: str,
-     utc_point_in_time: datetime.datetime | None = None,
-     offset: datetime.timedelta | None = None,
- ) -> datetime.datetime:
-     """Calculate the next specified solar event."""
--    from astral import AstralError  # pylint: disable=import-outside-toplevel
--
-     if offset is None:
-         offset = datetime.timedelta()
- 
-     if utc_point_in_time is None:
-         utc_point_in_time = dt_util.utcnow()
- 
-+    kwargs = {"local": False}
-+    if event not in ELEVATION_AGNOSTIC_EVENTS:
-+        kwargs["observer_elevation"] = elevation
-+
-     mod = -1
-     while True:
-         try:
-@@ -73,13 +83,13 @@ def get_location_astral_event_next(
-                 getattr(location, event)(
-                     dt_util.as_local(utc_point_in_time).date()
-                     + datetime.timedelta(days=mod),
--                    local=False,
-+                    **kwargs,
-                 )
-                 + offset
-             )
-             if next_dt > utc_point_in_time:
-                 return next_dt
--        except AstralError:
-+        except ValueError:
-             pass
-         mod += 1
- 
-@@ -92,9 +102,7 @@ def get_astral_event_date(
-     date: datetime.date | datetime.datetime | None = None,
- ) -> datetime.datetime | None:
-     """Calculate the astral event time for the specified date."""
--    from astral import AstralError  # pylint: disable=import-outside-toplevel
--
--    location = get_astral_location(hass)
-+    location, elevation = get_astral_location(hass)
- 
-     if date is None:
-         date = dt_util.now().date()
-@@ -102,9 +110,13 @@ def get_astral_event_date(
-     if isinstance(date, datetime.datetime):
-         date = dt_util.as_local(date).date()
- 
-+    kwargs = {"local": False}
-+    if event not in ELEVATION_AGNOSTIC_EVENTS:
-+        kwargs["observer_elevation"] = elevation
-+
-     try:
--        return getattr(location, event)(date, local=False)  # type: ignore
--    except AstralError:
-+        return getattr(location, event)(date, **kwargs)  # type: ignore
-+    except ValueError:
-         # Event never occurs for specified date.
-         return None
- 
-diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt
-index c5f0ccde05..449c0602df 100644
---- a/homeassistant/package_constraints.txt
-+++ b/homeassistant/package_constraints.txt
-@@ -3,7 +3,7 @@ PyNaCl==1.3.0
- aiodiscover==1.3.3
- aiohttp==3.7.4.post0
- aiohttp_cors==0.7.0
--astral==1.10.1
-+astral==2.2
- async-upnp-client==0.16.0
- async_timeout==3.0.1
- attrs==20.3.0
-diff --git a/requirements.txt b/requirements.txt
-index 5f633eaeb6..a3facbe5ab 100644
---- a/requirements.txt
-+++ b/requirements.txt
-@@ -2,7 +2,7 @@
- 
- # Home Assistant Core
- aiohttp==3.7.4.post0
--astral==1.10.1
-+astral==2.2
- async_timeout==3.0.1
- attrs==20.3.0
- awesomeversion==21.2.3
-diff --git a/setup.py b/setup.py
-index 56e5639148..f74a913cb8 100755
---- a/setup.py
-+++ b/setup.py
-@@ -33,7 +33,7 @@ PACKAGES = find_packages(exclude=["tests", "tests.*"])
- 
- REQUIRES = [
-     "aiohttp==3.7.4.post0",
--    "astral==1.10.1",
-+    "astral==2.2",
-     "async_timeout==3.0.1",
-     "attrs==20.3.0",
-     "awesomeversion==21.2.3",
--- 
-2.31.1
-

Modified: home-assistant.service
===================================================================
--- home-assistant.service	2021-05-07 10:23:57 UTC (rev 928587)
+++ home-assistant.service	2021-05-07 10:29:51 UTC (rev 928588)
@@ -9,6 +9,8 @@
 DynamicUser=true
 LogsDirectory=hass
 StateDirectory=hass
+WorkingDirectory=/var/lib/hass
+Environment=HOME=/var/lib/hass
 
 ExecStart=/usr/bin/hass \
   --config /var/lib/hass/ \



More information about the arch-commits mailing list