-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to download ffi binaries. (#39)
* Add script to download ffi binaries. * Remove built-in binaries. * Added installation reminder for iOS.
- Loading branch information
1 parent
de68f2c
commit 5f19cb0
Showing
12 changed files
with
78 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import os | ||
import urllib.request | ||
import configparser | ||
import zipfile | ||
|
||
# prepare progressbar | ||
def show_progress(block_num, block_size, total_size): | ||
print(round(block_num * block_size / total_size *100,2), end="\r") | ||
|
||
platforms = ['android', 'ios', 'macos', 'linux', 'windows'] | ||
download_dir = 'downloads~' | ||
|
||
def main(): | ||
config = configparser.ConfigParser() | ||
config.read('version.ini') | ||
version = config['ffi']['version'] | ||
|
||
for platform in platforms: | ||
archs = ['arm64', 'x86_64'] | ||
if platform == 'android': | ||
archs = [ 'armv7', 'arm64', 'x86_64'] | ||
elif platform == 'ios': | ||
archs = ['arm64', 'sim-arm64'] | ||
|
||
for arch in archs: | ||
filename = 'ffi-' + platform + '-' + arch + '.zip' | ||
url = config['ffi']['url'] + '/ffi-' + version + '/' + filename | ||
file_to_download = download_dir + '/' + filename | ||
if download_file_if_not_exists(url, file_to_download) : | ||
dest = 'Runtime/Plugins' + '/ffi-' + platform + '-' + arch | ||
unzip_file(file_to_download, filename, dest) | ||
|
||
def download_file_if_not_exists(url, filename): | ||
if os.path.isdir(download_dir) == False: | ||
print( download_dir + " directory not exists, creating one...") | ||
os.makedirs(download_dir) | ||
if os.path.isfile(filename): | ||
print("file " + filename + " exists, skipping download") | ||
return False | ||
print("downloading file " + url) | ||
urllib.request.urlretrieve(url, filename, show_progress) | ||
return True | ||
|
||
def unzip_file(srcfile, filename, dest): | ||
print("unzipping " + filename + " to " + dest) | ||
with zipfile.ZipFile(srcfile, 'r') as zip_ref: | ||
zip_ref.extractall(dest) | ||
print("unzipped " + srcfile) | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ffi] | ||
version = v0.5.0 | ||
url = https://github.com/livekit/rust-sdks/releases/download |