本文整理汇总了Python中devicemanager.DeviceManager.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceManager.__init__方法的具体用法?Python DeviceManager.__init__怎么用?Python DeviceManager.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类devicemanager.DeviceManager
的用法示例。
在下文中一共展示了DeviceManager.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from devicemanager import DeviceManager [as 别名]
# 或者: from devicemanager.DeviceManager import __init__ [as 别名]
def __init__(self, host=None, port=5555, retryLimit=5, packageName='fennec',
adbPath='adb', deviceSerial=None, deviceRoot=None,
logLevel=mozlog.ERROR, autoconnect=True, runAdbAsRoot=False, **kwargs):
DeviceManager.__init__(self, logLevel=logLevel,
deviceRoot=deviceRoot)
self.host = host
self.port = port
self.retryLimit = retryLimit
# the path to adb, or 'adb' to assume that it's on the PATH
self._adbPath = adbPath
# The serial number of the device to use with adb, used in cases
# where multiple devices are being managed by the same adb instance.
self._deviceSerial = deviceSerial
# Some devices do no start adb as root, if allowed you can use
# this to reboot adbd on the device as root automatically
self._runAdbAsRoot = runAdbAsRoot
if packageName == 'fennec':
if os.getenv('USER'):
self._packageName = 'org.mozilla.fennec_' + os.getenv('USER')
else:
self._packageName = 'org.mozilla.fennec_'
elif packageName:
self._packageName = packageName
# verify that we can run the adb command. can't continue otherwise
self._verifyADB()
if autoconnect:
self.connect()
示例2: __init__
# 需要导入模块: from devicemanager import DeviceManager [as 别名]
# 或者: from devicemanager.DeviceManager import __init__ [as 别名]
def __init__(self, host=None, port=5555, retryLimit=5, packageName='fennec',
adbPath='adb', deviceSerial=None, deviceRoot=None,
logLevel=mozlog.ERROR, **kwargs):
DeviceManager.__init__(self, logLevel)
self.host = host
self.port = port
self.retryLimit = retryLimit
self.deviceRoot = deviceRoot
# the path to adb, or 'adb' to assume that it's on the PATH
self._adbPath = adbPath
# The serial number of the device to use with adb, used in cases
# where multiple devices are being managed by the same adb instance.
self._deviceSerial = deviceSerial
if packageName == 'fennec':
if os.getenv('USER'):
self._packageName = 'org.mozilla.fennec_' + os.getenv('USER')
else:
self._packageName = 'org.mozilla.fennec_'
elif packageName:
self._packageName = packageName
# verify that we can run the adb command. can't continue otherwise
self._verifyADB()
# try to connect to the device over tcp/ip if we have a hostname
if self.host:
self._connectRemoteADB()
# verify that we can connect to the device. can't continue
self._verifyDevice()
# set up device root
self._setupDeviceRoot()
# Some commands require root to work properly, even with ADB (e.g.
# grabbing APKs out of /data). For these cases, we check whether
# we're running as root. If that isn't true, check for the
# existence of an su binary
self._checkForRoot()
# Can we use run-as? (not required)
try:
self._verifyRunAs()
except DMError:
pass
# can we use zip to speed up some file operations? (currently not
# required)
try:
self._verifyZip()
except DMError:
pass
示例3: __init__
# 需要导入模块: from devicemanager import DeviceManager [as 别名]
# 或者: from devicemanager.DeviceManager import __init__ [as 别名]
def __init__(self, host, port=20701, retryLimit=5, deviceRoot=None,
logLevel=logging.ERROR, **kwargs):
DeviceManager.__init__(self, logLevel=logLevel,
deviceRoot=deviceRoot)
self.host = host
self.port = port
self.retryLimit = retryLimit
self._sock = None
self._everConnected = False
# Get version
verstring = self._runCmds([{'cmd': 'ver'}])
ver_re = re.match('(\S+) Version (\S+)', verstring)
self.agentProductName = ver_re.group(1)
self.agentVersion = ver_re.group(2)
示例4: __init__
# 需要导入模块: from devicemanager import DeviceManager [as 别名]
# 或者: from devicemanager.DeviceManager import __init__ [as 别名]
def __init__(self, host, port=20701, retryLimit=5, deviceRoot=None, logLevel=mozlog.ERROR, **kwargs):
DeviceManager.__init__(self, logLevel)
self.host = host
self.port = port
self.retryLimit = retryLimit
self._sock = None
self._everConnected = False
self.deviceRoot = deviceRoot
# Initialize device root
self.getDeviceRoot()
# Get version
verstring = self._runCmds([{"cmd": "ver"}])
ver_re = re.match("(\S+) Version (\S+)", verstring)
self.agentProductName = ver_re.group(1)
self.agentVersion = ver_re.group(2)