mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Fix mypy pre-commit hook on windows (#1081)
This commit is contained in:
parent
1c83675e57
commit
7416e855f1
@ -1,3 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
source $(poetry env info --path)/bin/activate
|
|
||||||
|
OS_KERNEL=$(uname -s)
|
||||||
|
OS_VER=$(uname -v)
|
||||||
|
if [[ ( $OS_KERNEL == "Linux" && $OS_VER == *"Microsoft"* ) ]]; then
|
||||||
|
echo "Pre-commit hook needs git-bash to run. It cannot run in the windows linux subsystem."
|
||||||
|
echo "Add git bin directory to the front of your path variable, e.g:"
|
||||||
|
echo "set PATH=C:\Program Files\Git\bin;%PATH%"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ "$(expr substr $OS_KERNEL 1 10)" == "MINGW64_NT" ]]; then
|
||||||
|
POETRY_PATH=$(poetry.exe env info --path)
|
||||||
|
source "$POETRY_PATH"\\Scripts\\activate
|
||||||
|
else
|
||||||
|
source $(poetry env info --path)/bin/activate
|
||||||
|
fi
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
@ -209,7 +209,8 @@ class _DiscoverProtocol(asyncio.DatagramProtocol):
|
|||||||
except OSError as ex: # WSL does not support SO_REUSEADDR, see #246
|
except OSError as ex: # WSL does not support SO_REUSEADDR, see #246
|
||||||
_LOGGER.debug("Unable to set SO_REUSEADDR: %s", ex)
|
_LOGGER.debug("Unable to set SO_REUSEADDR: %s", ex)
|
||||||
|
|
||||||
if self.interface is not None:
|
# windows does not support SO_BINDTODEVICE
|
||||||
|
if self.interface is not None and hasattr(socket, "SO_BINDTODEVICE"):
|
||||||
sock.setsockopt(
|
sock.setsockopt(
|
||||||
socket.SOL_SOCKET, socket.SO_BINDTODEVICE, self.interface.encode()
|
socket.SOL_SOCKET, socket.SO_BINDTODEVICE, self.interface.encode()
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user