FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix mypy pre-commit hook on windows by sdb9696 · Pull Request #1081 · python-kasa/python-kasa · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .sh  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
18 changes: 16 additions & 2 deletions devtools/run-in-env.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
#!/bin/bash
source $(poetry env info --path)/bin/activate
#!/usr/bin/env bash

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 "$@"
3 changes: 2 additions & 1 deletion kasa/discover.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ def connection_made(self, transport) -> None:
except OSError as ex: # WSL does not support SO_REUSEADDR, see #246
_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(
socket.SOL_SOCKET, socket.SO_BINDTODEVICE, self.interface.encode()
)
Expand Down

Back | FazBrowse Home | New Git URL