Skip to content

Commit

Permalink
Handle possible presence of aiodns on Windows
Browse files Browse the repository at this point in the history
aiodns on Windows requires SelectorEventLoop, which does not support asyncio subprocess, breaking the "execute" plugin. It gets installed due to being specified as mandatory requirement of slixmpp.

aiohttp, which also uses aiodns as an optional requirement, used a workaround to prevent it from failing on Windows, however, it got removed in version 3.10.0

This commit bundles fixes for this situation:

- monkey-patch slixmpp.xmlstream.resolver in msg2jbr_slixmpp.py
- limit aiohttp version to <3.10.0
- remove aiodns from github action for building .exe before running pyinstaller
  • Loading branch information
user committed Aug 24, 2024
1 parent f83a8a1 commit 7d86d41
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/publish-exe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Build executable
on:
release:
types: [published]
workflow_dispatch:


jobs:
Expand All @@ -28,6 +29,8 @@ jobs:
run: python -m build
- name: Install locally
run: python -m pip install -e .
- name: Uninstall aiodns, installed by slixmpp
run: python -m pip uninstall aiodns --yes
- name: Build executable as a single file
run: pyinstaller avtdl.py --icon NONE --collect-all avtdl --onefile
- name: Build executable as a folder
Expand Down
4 changes: 4 additions & 0 deletions avtdl/plugins/xmpp/msg2jbr_slixmpp.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import asyncio
import logging
import sys
from dataclasses import dataclass
from typing import Callable, Optional

import slixmpp

if sys.platform == 'win32':
slixmpp.xmlstream.resolver.AIODNS_AVAILABLE = False

ON_ERROR_RETRY_DELAY = 60
DISCONNECT_AFTER_DONE_DELAY = 30

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ dynamic = ["version"]
requires-python = ">= 3.9"
dependencies = [
"pydantic",
"aiohttp",
"aiohttp<3.10;sys_platform == 'win32'",
"aiohttp;sys_platform != 'win32'",
"multidict",
"feedparser",
"python-dateutil",
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pydantic
aiohttp
aiohttp<3.10;sys_platform == 'win32'
aiohttp;sys_platform != 'win32'
multidict
feedparser
python-dateutil
Expand Down

0 comments on commit 7d86d41

Please sign in to comment.