Skip to content
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.

Commit

Permalink
add ios utils
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed May 1, 2016
1 parent 9b54dd3 commit f05f5f0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions atx/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, serial=None, server_host=None, server_port=None):

@classmethod
def adb(cls):
"""return adb binary full path"""
if cls.__adb_cmd is None:
if "ANDROID_HOME" in os.environ:
filename = "adb.exe" if os.name == 'nt' else "adb"
Expand Down
2 changes: 1 addition & 1 deletion atx/cmds/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def adb_pushfile(adb, filepath, remote_path):
pb.refresh()
# log.info("Progress %dM/%dM", get_file_size(remote_path) >>20, filesize >>20)
pass
except KeyboardInterrupt:
except (KeyboardInterrupt, SystemExit) as e:
p.kill()
raise
except:
Expand Down
2 changes: 2 additions & 0 deletions atx/device/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ def type(self, text):
"""Input some text, TODO(ssx): not tested.
Args:
text: string (text to input)
TODO: escape space
"""
self.adb_shell(['input', 'text', text])
return self
19 changes: 19 additions & 0 deletions atx/ios.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import subprocess32 as subprocess


class IOS(object):
@classmethod
def cmd(cls, *args):
return subprocess.Popen(list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE)

@classmethod
def devices(cls):
p = cls.cmd('idevice_id', '-l')
return p.communicate()[0].strip().split()


if __name__ == '__main__':
print IOS.devices()

0 comments on commit f05f5f0

Please sign in to comment.