Compare commits
No commits in common. "56c2eb1671f846f3c62f031d3c5f057867f21e6d" and "7ad8e4a781eab646ca6d1f79d9f6b50f16a54fd5" have entirely different histories.
56c2eb1671
...
7ad8e4a781
@ -1158,7 +1158,6 @@ done'
|
|||||||
)
|
)
|
||||||
|
|
||||||
def http_server(argv):
|
def http_server(argv):
|
||||||
from .commands_typed import os as commands_os
|
|
||||||
assert isinstance(argv, list) and all([isinstance(o, str) for o in argv])
|
assert isinstance(argv, list) and all([isinstance(o, str) for o in argv])
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
@ -1215,33 +1214,11 @@ def http_server(argv):
|
|||||||
assert options.port >= 1
|
assert options.port >= 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not options.docker and options.host == '0.0.0.0':
|
|
||||||
found : bool = False
|
|
||||||
for o in commands_os.interfaces_index():
|
|
||||||
if found:
|
|
||||||
break
|
|
||||||
for o2 in o.addr_info:
|
|
||||||
if o2.family == 'inet' and o2.local != '127.0.0.1':
|
|
||||||
options.host = o2.local
|
|
||||||
logger.info(dict(
|
|
||||||
host=options.host,
|
|
||||||
msg='found',
|
|
||||||
))
|
|
||||||
found = True
|
|
||||||
break
|
|
||||||
|
|
||||||
assert not socket.inet_aton(options.host) is None
|
assert not socket.inet_aton(options.host) is None
|
||||||
# subprocess.check_call([
|
subprocess.check_call([
|
||||||
# 'ping', '-w', '1',
|
'ping', '-w', '1',
|
||||||
# options.host
|
options.host
|
||||||
# ])
|
])
|
||||||
assert options.host in sum([
|
|
||||||
[
|
|
||||||
o2.local
|
|
||||||
for o2 in o.addr_info
|
|
||||||
]
|
|
||||||
for o in commands_os.interfaces_index()
|
|
||||||
], [])
|
|
||||||
except Exception:
|
except Exception:
|
||||||
raise RuntimeError('invalid ip address %s' % options.host)
|
raise RuntimeError('invalid ip address %s' % options.host)
|
||||||
|
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
import shutil
|
import shutil
|
||||||
import glob
|
import glob
|
||||||
import subprocess
|
|
||||||
import pydantic
|
|
||||||
import pathlib
|
import pathlib
|
||||||
import ctypes
|
import ctypes
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import dataclasses
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
from typing import (overload, Optional, Literal, Any, Annotated,)
|
from typing import (overload, Optional, Literal,)
|
||||||
|
|
||||||
from .cli_bootstrap import PyProject
|
from .cli_bootstrap import PyProject
|
||||||
|
|
||||||
@ -93,30 +90,3 @@ def runtime_libdirs_init(
|
|||||||
ctypes.cdll.LoadLibrary(preload_found)
|
ctypes.cdll.LoadLibrary(preload_found)
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
class interfaces_index_t:
|
|
||||||
@dataclasses.dataclass
|
|
||||||
class Interface:
|
|
||||||
@dataclasses.dataclass
|
|
||||||
class AddrInfo:
|
|
||||||
family: str
|
|
||||||
local: str
|
|
||||||
|
|
||||||
name: Annotated[
|
|
||||||
str,
|
|
||||||
pydantic.Field(
|
|
||||||
alias='ifname',
|
|
||||||
)
|
|
||||||
]
|
|
||||||
addr_info: list[AddrInfo]
|
|
||||||
|
|
||||||
def interfaces_index() -> list[interfaces_index_t.Interface]:
|
|
||||||
res = pydantic.RootModel[
|
|
||||||
list[interfaces_index_t.Interface]
|
|
||||||
].model_validate_json(
|
|
||||||
subprocess.check_output([
|
|
||||||
'ip', '-j', 'addr',
|
|
||||||
]).decode('utf-8')
|
|
||||||
).root
|
|
||||||
|
|
||||||
return res
|
|
||||||
|
BIN
releases/whl/online_fxreader_pr34-0.1.5.9+27.1-py3-none-any.whl
(Stored with Git LFS)
BIN
releases/whl/online_fxreader_pr34-0.1.5.9+27.1-py3-none-any.whl
(Stored with Git LFS)
Binary file not shown.
BIN
releases/whl/online_fxreader_pr34-0.1.5.9+27.2-py3-none-any.whl
(Stored with Git LFS)
BIN
releases/whl/online_fxreader_pr34-0.1.5.9+27.2-py3-none-any.whl
(Stored with Git LFS)
Binary file not shown.
BIN
releases/whl/online_fxreader_pr34-0.1.5.9+27.3-py3-none-any.whl
(Stored with Git LFS)
BIN
releases/whl/online_fxreader_pr34-0.1.5.9+27.3-py3-none-any.whl
(Stored with Git LFS)
Binary file not shown.
BIN
releases/whl/online_fxreader_pr34-0.1.5.9+27.4-py3-none-any.whl
(Stored with Git LFS)
BIN
releases/whl/online_fxreader_pr34-0.1.5.9+27.4-py3-none-any.whl
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in New Issue
Block a user