Bug 802242 - mirror mozbase -> m-c for week of Oct 16 @ aa50f7cf0f ; r=wlach
This commit is contained in:
0
testing/mozbase/mozdevice/mozdevice/Zeroconf.py
Normal file → Executable file
0
testing/mozbase/mozdevice/mozdevice/Zeroconf.py
Normal file → Executable file
@@ -160,24 +160,24 @@ class DeviceManagerADB(DeviceManager):
|
||||
"""
|
||||
Copies localname from the host to destname on the device
|
||||
"""
|
||||
try:
|
||||
if (os.name == "nt"):
|
||||
destname = destname.replace('\\', '/')
|
||||
if (self.useRunAs):
|
||||
# you might expect us to put the file *in* the directory in this case,
|
||||
# but that would be different behaviour from devicemanagerSUT. Throw
|
||||
# an exception so we have the same behaviour between the two
|
||||
# implementations
|
||||
if self.dirExists(destname):
|
||||
raise DMError("Attempted to push a file (%s) to a directory (%s)!" %
|
||||
(localname, destname))
|
||||
|
||||
if self.useRunAs:
|
||||
remoteTmpFile = self.getTempDir() + "/" + os.path.basename(localname)
|
||||
self._checkCmd(["push", os.path.realpath(localname), remoteTmpFile])
|
||||
if self.useDDCopy:
|
||||
self._checkCmdAs(["shell", "dd", "if=" + remoteTmpFile, "of=" + destname])
|
||||
self.shellCheckOutput(["dd", "if=" + remoteTmpFile, "of=" + destname])
|
||||
else:
|
||||
self._checkCmdAs(["shell", "cp", remoteTmpFile, destname])
|
||||
self._checkCmd(["shell", "rm", remoteTmpFile])
|
||||
self.shellCheckOutput(["cp", remoteTmpFile, destname])
|
||||
self.shellCheckOutput(["rm", remoteTmpFile])
|
||||
else:
|
||||
self._checkCmd(["push", os.path.realpath(localname), destname])
|
||||
if (self.dirExists(destname)):
|
||||
destname = destname + "/" + os.path.basename(localname)
|
||||
return True
|
||||
except:
|
||||
raise DMError("Error pushing file to device")
|
||||
|
||||
def mkDir(self, name):
|
||||
"""
|
||||
@@ -195,18 +195,18 @@ class DeviceManagerADB(DeviceManager):
|
||||
# contains symbolic links, the links are pushed, rather than the linked
|
||||
# files; we either zip/unzip or push file-by-file to get around this
|
||||
# limitation
|
||||
if (not self.dirExists(remoteDir)):
|
||||
if not self.dirExists(remoteDir):
|
||||
self.mkDirs(remoteDir+"/x")
|
||||
if (self.useZip):
|
||||
if self.useZip:
|
||||
try:
|
||||
localZip = tempfile.mktemp()+".zip"
|
||||
localZip = tempfile.mktemp() + ".zip"
|
||||
remoteZip = remoteDir + "/adbdmtmp.zip"
|
||||
subprocess.check_output(["zip", "-r", localZip, '.'], cwd=localDir)
|
||||
self.pushFile(localZip, remoteZip)
|
||||
os.remove(localZip)
|
||||
data = self._runCmdAs(["shell", "unzip", "-o", remoteZip, "-d", remoteDir]).stdout.read()
|
||||
self._checkCmdAs(["shell", "rm", remoteZip])
|
||||
if (re.search("unzip: exiting", data) or re.search("Operation not permitted", data)):
|
||||
if re.search("unzip: exiting", data) or re.search("Operation not permitted", data):
|
||||
raise Exception("unzip failed, or permissions error")
|
||||
except:
|
||||
print "zip/unzip failure: falling back to normal push"
|
||||
@@ -218,16 +218,15 @@ class DeviceManagerADB(DeviceManager):
|
||||
for f in files:
|
||||
localFile = os.path.join(root, f)
|
||||
remoteFile = remoteDir + "/"
|
||||
if (relRoot!="."):
|
||||
if relRoot != ".":
|
||||
remoteFile = remoteFile + relRoot + "/"
|
||||
remoteFile = remoteFile + f
|
||||
self.pushFile(localFile, remoteFile)
|
||||
for d in dirs:
|
||||
targetDir = remoteDir + "/"
|
||||
if (relRoot!="."):
|
||||
if relRoot != ".":
|
||||
targetDir = targetDir + relRoot + "/"
|
||||
targetDir = targetDir + d
|
||||
if (not self.dirExists(targetDir)):
|
||||
self.mkDir(targetDir)
|
||||
|
||||
def dirExists(self, remotePath):
|
||||
@@ -554,10 +553,9 @@ class DeviceManagerADB(DeviceManager):
|
||||
"""
|
||||
# Cache result to speed up operations depending
|
||||
# on the temporary directory.
|
||||
if self.tempDir == None:
|
||||
if not self.tempDir:
|
||||
self.tempDir = self.getDeviceRoot() + "/tmp"
|
||||
if (not self.dirExists(self.tempDir)):
|
||||
return self.mkDir(self.tempDir)
|
||||
self.mkDir(self.tempDir)
|
||||
|
||||
return self.tempDir
|
||||
|
||||
|
||||
@@ -130,23 +130,27 @@ class DMCli(object):
|
||||
parser.add_option("-v", "--verbose", action="store_true",
|
||||
dest="verbose",
|
||||
help="Verbose output from DeviceManager",
|
||||
default = False)
|
||||
default=False)
|
||||
parser.add_option("--host", action="store",
|
||||
type = "string", dest = "host",
|
||||
help = "Device hostname (only if using TCP/IP)",
|
||||
type="string", dest="host",
|
||||
help="Device hostname (only if using TCP/IP)",
|
||||
default=os.environ.get('TEST_DEVICE'))
|
||||
parser.add_option("-p", "--port", action="store",
|
||||
type = "int", dest = "port",
|
||||
help = "Custom device port (if using SUTAgent or "
|
||||
type="int", dest="port",
|
||||
help="Custom device port (if using SUTAgent or "
|
||||
"adb-over-tcp)", default=None)
|
||||
parser.add_option("-m", "--dmtype", action="store",
|
||||
type = "string", dest = "dmtype",
|
||||
help = "DeviceManager type (adb or sut, defaults " \
|
||||
type="string", dest="dmtype",
|
||||
help="DeviceManager type (adb or sut, defaults " \
|
||||
"to adb)", default=os.environ.get('DM_TRANS',
|
||||
'adb'))
|
||||
parser.add_option("-d", "--hwid", action="store",
|
||||
type="string", dest="hwid",
|
||||
help="HWID", default=None)
|
||||
parser.add_option("--package-name", action="store",
|
||||
type="string", dest="packagename",
|
||||
help="Packagename (if using DeviceManagerADB)",
|
||||
default=None)
|
||||
|
||||
def getDevice(self, dmtype="adb", hwid=None, host=None, port=None):
|
||||
'''
|
||||
@@ -161,8 +165,8 @@ class DMCli(object):
|
||||
if dmtype == "adb":
|
||||
if host and not port:
|
||||
port = 5555
|
||||
return mozdevice.DroidADB(packageName=None, host=host,
|
||||
port=port)
|
||||
return mozdevice.DroidADB(packageName=self.options.packagename,
|
||||
host=host, port=port)
|
||||
elif dmtype == "sut":
|
||||
if not host:
|
||||
self.parser.error("Must specify host with SUT!")
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import os
|
||||
from setuptools import setup
|
||||
|
||||
PACKAGE_VERSION = '0.11'
|
||||
PACKAGE_VERSION = '0.12'
|
||||
|
||||
# take description from README
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
@@ -14,7 +14,7 @@ try:
|
||||
except (OSError, IOError):
|
||||
description = ''
|
||||
|
||||
deps = ['mozprocess == 0.7']
|
||||
deps = ['mozprocess == 0.8']
|
||||
|
||||
setup(name='mozdevice',
|
||||
version=PACKAGE_VERSION,
|
||||
|
||||
@@ -198,7 +198,7 @@ class ProcessHandlerMixin(object):
|
||||
self.pid = pid
|
||||
self.tid = tid
|
||||
|
||||
if canCreateJob:
|
||||
if not self._ignore_children and canCreateJob:
|
||||
try:
|
||||
# We create a new job for this process, so that we can kill
|
||||
# the process and any sub-processes
|
||||
@@ -392,6 +392,7 @@ falling back to not using job objects for managing child processes"""
|
||||
|
||||
# Python 2.5 uses isAlive versus is_alive use the proper one
|
||||
threadalive = False
|
||||
if hasattr(self, "_procmgrthread"):
|
||||
if hasattr(self._procmgrthread, 'is_alive'):
|
||||
threadalive = self._procmgrthread.is_alive()
|
||||
else:
|
||||
@@ -426,7 +427,7 @@ falling back to not using job objects for managing child processes"""
|
||||
# Not managing with job objects, so all we can reasonably do
|
||||
# is call waitforsingleobject and hope for the best
|
||||
|
||||
if MOZPROCESS_DEBUG:
|
||||
if MOZPROCESS_DEBUG and not self._ignore_children:
|
||||
print "DBG::MOZPROC NOT USING JOB OBJECTS!!!"
|
||||
# First, make sure we have not already ended
|
||||
if self.returncode != winprocess.STILL_ACTIVE:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import os
|
||||
from setuptools import setup
|
||||
|
||||
PACKAGE_VERSION = '0.7'
|
||||
PACKAGE_VERSION = '0.8'
|
||||
|
||||
# take description from README
|
||||
here = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
@@ -7,7 +7,7 @@ import sys
|
||||
from setuptools import setup
|
||||
|
||||
PACKAGE_NAME = "mozrunner"
|
||||
PACKAGE_VERSION = '5.13'
|
||||
PACKAGE_VERSION = '5.14'
|
||||
|
||||
desc = """Reliable start/stop/configuration of Mozilla Applications (Firefox, Thunderbird, etc.)"""
|
||||
# take description from README
|
||||
@@ -18,7 +18,7 @@ except (OSError, IOError):
|
||||
description = ''
|
||||
|
||||
deps = ['mozinfo == 0.4',
|
||||
'mozprocess == 0.7',
|
||||
'mozprocess == 0.8',
|
||||
'mozprofile == 0.4',
|
||||
]
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ def dependency_info(dep):
|
||||
retval['Version'] = version
|
||||
break
|
||||
else:
|
||||
retval['name'] = dep.strip()
|
||||
retval['Name'] = dep.strip()
|
||||
return retval
|
||||
|
||||
def unroll_dependencies(dependencies):
|
||||
|
||||
Reference in New Issue
Block a user