| 229 | return 0 |
| 230 | |
| 231 | def _push_source_path(self, cwd, source, target): |
| 232 | if not os.path.isabs(source): |
| 233 | source = os.path.join(cwd, source) |
| 234 | source = os.path.normpath(source) |
| 235 | |
| 236 | if not os.path.exists(source): |
| 237 | self._log('android-test: source %s not found, skipping' % source) |
| 238 | return 0 |
| 239 | |
| 240 | target = (target or '').replace(os.sep, '/').lstrip('/') |
| 241 | if not target: |
| 242 | target = os.path.basename(source) |
| 243 | |
| 244 | device_path = '%s/%s' % (self._library_root, target) |
| 245 | |
| 246 | if os.path.isdir(source): |
| 247 | self._log('android-test: staging folder %s to %s' % (source, device_path)) |
| 248 | |
| 249 | ret = self._run(['shell', 'mkdir', '-p', device_path]) |
| 250 | if ret != 0: |
| 251 | self._log('android-test: failed to create device folder %s' % device_path) |
| 252 | return ret |
| 253 | |
| 254 | ret = self._run(['push', source + '/.', device_path]) |
| 255 | if ret != 0: |
| 256 | self._log('android-test: failed to push folder %s' % source) |
| 257 | return ret |
| 258 | else: |
| 259 | self._log('android-test: staging file %s to %s' % (source, device_path)) |
| 260 | ret = self._push_file(source, device_path) |
| 261 | if ret != 0: |
| 262 | return ret |
| 263 | |
| 264 | return 0 |
| 265 | |
| 266 | def prepare(self, cwd, configfile, folders = None): |
| 267 | self._prepared = True |