mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-04 20:45:49 +08:00
[socket/_socket] Restore bluetooth socket constants on Linux (#15209)
This commit is contained in:
@@ -27,6 +27,15 @@ fcntl.I_[A-Z0-9_]+ # Platform differences that cannot be captured by the type s
|
||||
multiprocessing.popen_spawn_win32 # exists on Linux but fails to import
|
||||
select.poll # Actually a function; we have a class so it can be used as a type
|
||||
|
||||
# Bluetooth constants which aren't on the GitHub Actions runners, see #15207
|
||||
(_?socket\.AF_BLUETOOTH)?
|
||||
(_?socket\.BDADDR_ANY)?
|
||||
(_?socket\.BDADDR_LOCAL)?
|
||||
(_?socket\.BTPROTO_HCI)?
|
||||
(_?socket\.BTPROTO_L2CAP)?
|
||||
(_?socket\.BTPROTO_RFCOMM)?
|
||||
(_?socket\.BTPROTO_SCO)?
|
||||
|
||||
# These seem like they should be available on Linux, but they're not
|
||||
# on GitHub Actions runners for some reason.
|
||||
_?socket.IPX_TYPE
|
||||
|
||||
+4
-4
@@ -587,7 +587,7 @@ if sys.platform != "linux":
|
||||
|
||||
has_ipv6: bool
|
||||
|
||||
if sys.platform != "darwin" and sys.platform != "linux":
|
||||
if sys.platform != "darwin":
|
||||
BDADDR_ANY: Final = "00:00:00:00:00:00"
|
||||
BDADDR_LOCAL: Final = "00:00:00:FF:FF:FF"
|
||||
|
||||
@@ -660,16 +660,16 @@ if sys.platform == "darwin":
|
||||
PF_SYSTEM: Final[int]
|
||||
SYSPROTO_CONTROL: Final[int]
|
||||
|
||||
if sys.platform != "darwin" and sys.platform != "linux":
|
||||
if sys.platform != "darwin":
|
||||
AF_BLUETOOTH: Final[int]
|
||||
|
||||
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
|
||||
if sys.platform != "win32" and sys.platform != "darwin":
|
||||
# Linux and some BSD support is explicit in the docs
|
||||
# Windows and macOS do not support in practice
|
||||
BTPROTO_HCI: Final[int]
|
||||
BTPROTO_L2CAP: Final[int]
|
||||
BTPROTO_SCO: Final[int] # not in FreeBSD
|
||||
if sys.platform != "darwin" and sys.platform != "linux":
|
||||
if sys.platform != "darwin":
|
||||
BTPROTO_RFCOMM: Final[int]
|
||||
|
||||
if sys.platform == "linux":
|
||||
|
||||
+6
-4
@@ -519,9 +519,10 @@ if sys.platform != "win32":
|
||||
|
||||
__all__ += ["SO_BINDTODEVICE"]
|
||||
|
||||
if sys.platform != "darwin" and sys.platform != "linux":
|
||||
if sys.platform != "darwin":
|
||||
from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM
|
||||
|
||||
if sys.platform != "darwin" and sys.platform != "linux":
|
||||
__all__ += ["BDADDR_ANY", "BDADDR_LOCAL", "BTPROTO_RFCOMM"]
|
||||
|
||||
if sys.platform == "darwin" and sys.version_info >= (3, 10):
|
||||
@@ -969,9 +970,10 @@ if sys.platform != "linux":
|
||||
if sys.platform != "darwin" and sys.platform != "linux":
|
||||
__all__ += ["AF_BLUETOOTH"]
|
||||
|
||||
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
|
||||
if sys.platform != "win32" and sys.platform != "darwin":
|
||||
from _socket import BTPROTO_HCI as BTPROTO_HCI, BTPROTO_L2CAP as BTPROTO_L2CAP, BTPROTO_SCO as BTPROTO_SCO
|
||||
|
||||
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
|
||||
__all__ += ["BTPROTO_HCI", "BTPROTO_L2CAP", "BTPROTO_SCO"]
|
||||
|
||||
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
|
||||
@@ -1131,7 +1133,7 @@ class AddressFamily(IntEnum):
|
||||
AF_QIPCRTR = 42
|
||||
if sys.platform != "linux":
|
||||
AF_LINK = 33
|
||||
if sys.platform != "darwin" and sys.platform != "linux":
|
||||
if sys.platform != "darwin":
|
||||
AF_BLUETOOTH = 32
|
||||
if sys.platform == "win32" and sys.version_info >= (3, 12):
|
||||
AF_HYPERV = 34
|
||||
@@ -1186,7 +1188,7 @@ if sys.platform == "linux":
|
||||
|
||||
if sys.platform != "linux":
|
||||
AF_LINK: Final = AddressFamily.AF_LINK
|
||||
if sys.platform != "darwin" and sys.platform != "linux":
|
||||
if sys.platform != "darwin":
|
||||
AF_BLUETOOTH: Final = AddressFamily.AF_BLUETOOTH
|
||||
if sys.platform == "win32" and sys.version_info >= (3, 12):
|
||||
AF_HYPERV: Final = AddressFamily.AF_HYPERV
|
||||
|
||||
Reference in New Issue
Block a user