forked from mirrors/gecko-dev
Bug 1942259 - Move telnetlib import to BaseEmulator a=dmeehan
emulator.py currently has an unconditional telnetlib import, but the file can also be imported when the functionality is not needed. Because telnetlib was removed from Python 3.13, this unconditional import breaks use cases that do not even care about telnet. As a stopgap measure until a better fix is available, move the import to the function that relies on telnet. Original Revision: https://phabricator.services.mozilla.com/D227995 Differential Revision: https://phabricator.services.mozilla.com/D236164
This commit is contained in:
parent
c3b0d15ca3
commit
a03dc5f488
1 changed files with 5 additions and 1 deletions
|
|
@ -8,7 +8,6 @@ import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
from telnetlib import Telnet
|
|
||||||
|
|
||||||
from mozdevice import ADBHost
|
from mozdevice import ADBHost
|
||||||
from mozprocess import ProcessHandler
|
from mozprocess import ProcessHandler
|
||||||
|
|
@ -189,6 +188,11 @@ class BaseEmulator(Device):
|
||||||
|
|
||||||
def _run_telnet(self, command):
|
def _run_telnet(self, command):
|
||||||
if not self.telnet:
|
if not self.telnet:
|
||||||
|
# telnetlib is dropped in Python 3.13 (bug 1925198).
|
||||||
|
# Import here instead of the top level to avoid breaking users of
|
||||||
|
# this file that are independent of telnet.
|
||||||
|
from telnetlib import Telnet
|
||||||
|
|
||||||
self.telnet = Telnet("localhost", self.port)
|
self.telnet = Telnet("localhost", self.port)
|
||||||
self._get_telnet_response()
|
self._get_telnet_response()
|
||||||
return self._get_telnet_response(command)
|
return self._get_telnet_response(command)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue