Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
- name: Install dependencies
run: poetry install
- name: Build and publish to pypi
uses: JRubics/poetry-publish@v1.6
uses: JRubics/poetry-publish@v1.17
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
11 changes: 6 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Tests
on:
push:
branches:
- "*"
pull_request:

jobs:
Expand All @@ -12,11 +11,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: [3.8, 3.9, "3.10"]
python: [3.8, 3.9, "3.10", "3.11"]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install APT dependencies
Expand All @@ -25,7 +25,7 @@ jobs:
run: pip install poetry
- name: Use in-project virtualenv
run: poetry config virtualenvs.in-project true
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: .venv/
key: ${{ runner.os }}-${{ matrix.python }}-pip-${{ hashFiles('poetry.lock') }}-${{ hashFiles('pyproject.toml') }}
Expand All @@ -38,4 +38,5 @@ jobs:
- name: Unit tests
run: make test-cov
- name: Build Docs
if: matrix.python != '3.11'
run: make docs
2 changes: 1 addition & 1 deletion astoria/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"__version__",
]

__version__ = "0.11.1"
__version__ = "0.11.3"
6 changes: 4 additions & 2 deletions astoria/astprocd/usercode_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import asyncio
import logging
import sys
from datetime import datetime, timedelta
from os import environ
from os import environ, fsync
from signal import SIGKILL, SIGTERM
from string import Template
from typing import IO, Callable, Dict, Optional
Expand Down Expand Up @@ -110,7 +111,7 @@ async def run_process(self) -> None:
)
self._process_end_event.clear()
self._process = await asyncio.create_subprocess_exec(
"python3",
sys.executable,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very neat way of handling this.

"-u",
self._entrypoint,
stdin=asyncio.subprocess.DEVNULL,
Expand Down Expand Up @@ -207,6 +208,7 @@ def log(
) -> None:
fh.write(data)
fh.flush()
fsync(fh.fileno())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding this, we had too many issues with logs not being synced to disk.

self._log_helper.send(
pid=pid,
priority=log_line_idx,
Expand Down
2 changes: 1 addition & 1 deletion astoria/astwifid.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def generate_hostapd_config(self) -> None:
"bridge": self._bridge,
"ssid": self._ssid,
"country_code": self._region,
"channel": 7,
"channel": 6,
Comment thread
RealOrangeOne marked this conversation as resolved.
"hw_mode": "g",
# Bit field: bit0 = WPA, bit1 = WPA2
"wpa": 2,
Expand Down
5 changes: 4 additions & 1 deletion astoria/common/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ def get_os_version_info(cls) -> Dict[str, str]:
"""
system = platform.system()
if system == "Linux":
return cls.get_os_release_info()
if Path('/etc/srobo-release').exists():
return cls.get_os_release_info(Path('/etc/srobo-release'))
else:
return cls.get_os_release_info()
elif system == "Darwin":
return cls.get_macos_release_info()
return {}
Expand Down
2 changes: 1 addition & 1 deletion astoria/common/mqtt/broadcast_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def _handle_broadcast(
except JSONDecodeError:
LOGGER.warning(f"Broadcast event {self._name} contained invalid JSON")

def send(self, **kwargs: Any) -> None: # type: ignore
def send(self, **kwargs: Any) -> None:
"""Send an event."""
data = self._schema(
event_name=self._schema.name,
Expand Down
13 changes: 8 additions & 5 deletions astoria/common/mqtt/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Match,
Optional,
TypeVar,
Union,
)
from uuid import UUID

Expand All @@ -25,7 +26,7 @@

LOGGER = logging.getLogger(__name__)

Handler = Callable[[Match[str], str], Coroutine[Any, Any, None]] # type: ignore
Handler = Callable[[Match[str], str], Coroutine[Any, Any, None]]
RequestT = TypeVar("RequestT", bound=ManagerRequest)


Expand Down Expand Up @@ -230,12 +231,14 @@ async def wait_dependencies(self) -> None:
if len(self._dependencies) > 0:
LOGGER.debug("Waiting for " + ", ".join(self._dependencies))

tasks = [asyncio.gather(
*(event.wait() for event in self._dependency_events.values()),
)]
tasks: List[Union[asyncio.Future[Any], asyncio.Task[Any]]] = [
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Should this Union simply be Awaitable?

asyncio.gather(
*(event.wait() for event in self._dependency_events.values()),
),
]

if self._no_dependency_event is not None:
tasks.append(self._no_dependency_event.wait()) # type: ignore
tasks.append(asyncio.create_task(self._no_dependency_event.wait()))

await asyncio.wait(
tasks,
Expand Down
7 changes: 0 additions & 7 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ no_implicit_optional = True
disallow_any_unimported = True
# disallow_any_expr = True
#disallow_any_decorated = True
disallow_any_explicit = True
disallow_subclassing_any = True
disallow_any_generics = True

Expand All @@ -20,9 +19,3 @@ disallow_incomplete_defs = True
disallow_untyped_decorators = True

check_untyped_defs = True

[mypy-dbus_next.*]
disallow_any_explicit = False

[mypy-gmqtt.*]
disallow_any_explicit = False
Loading