defadb(self):ifself.__adb_cmdisNone:if"ANDROID_HOME"inos.environ:filename="adb.exe"ifos.name=='nt'else"adb"adb_cmd=os.path.join(os.environ["ANDROID_HOME"],"platform-tools",filename)ifnotos.path.exists(adb_cmd):raiseEnvironmentError("Adb not found in $ANDROID_HOME path: %s."%os.environ["ANDROID_HOME"])else:importdistutilsif"spawn"notindir(distutils):importdistutils.spawnadb_cmd=distutils.spawn.find_executable("adb")ifadb_cmd:adb_cmd=os.path.realpath(adb_cmd)else:raiseEnvironmentError("$ANDROID_HOME environment not set.")self.__adb_cmd=adb_cmdreturnself.__adb_cmd