Skip to content

Commit 3553104

Browse files
committed
removed zip handling
1 parent 7ef7e39 commit 3553104

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

browserstack/local_binary.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ def __init__(self):
66
is_64bits = sys.maxsize > 2**32
77
osname = platform.system()
88
if osname == 'Darwin':
9-
self.http_path = "https://www.browserstack.com/browserstack-local/BrowserStackLocal-darwin-x64.zip"
9+
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-darwin-x64"
1010
elif osname == 'Linux':
1111
if is_64bits:
12-
self.http_path = "https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip"
12+
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-linux-x64"
1313
else:
14-
self.http_path = "https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-ia32.zip"
14+
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-linux-ia32"
1515
else:
16-
self.http_path = "https://www.browserstack.com/browserstack-local/BrowserStackLocal-win32.zip"
16+
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal.exe"
1717

1818
self.ordered_paths = [
1919
os.path.join(os.path.expanduser('~'), '.browserstack'),
@@ -47,7 +47,7 @@ def download(self, chunk_size=8192, progress_hook=None):
4747

4848
dest_parent_dir = self.__available_dir()
4949

50-
with open(os.path.join(dest_parent_dir, 'download.zip'), 'wb') as local_file:
50+
with open(os.path.join(dest_parent_dir, 'BrowserStackLocal'), 'wb') as local_file:
5151
while True:
5252
chunk = response.read(chunk_size)
5353
bytes_so_far += len(chunk)
@@ -63,17 +63,10 @@ def download(self, chunk_size=8192, progress_hook=None):
6363
except:
6464
return self.download(chunk_size, progress_hook)
6565

66-
with zipfile.ZipFile(open(os.path.join(dest_parent_dir, 'download.zip'), 'r')) as z:
67-
for name in z.namelist():
68-
try:
69-
z.extract(name, dest_parent_dir)
70-
except:
71-
return self.download(chunk_size, progress_hook)
72-
# There is only one file
73-
final_path = os.path.join(dest_parent_dir, name)
74-
st = os.stat(final_path)
75-
os.chmod(final_path, st.st_mode | stat.S_IXUSR)
76-
return final_path
66+
final_path = os.path.join(dest_parent_dir, 'BrowserStackLocal')
67+
st = os.stat(final_path)
68+
os.chmod(final_path, st.st_mode | stat.S_IXUSR)
69+
return final_path
7770

7871
def get_binary(self):
7972
dest_parent_dir = os.path.join(os.path.expanduser('~'), '.browserstack')

0 commit comments

Comments
 (0)