-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add helper script to download xcframework
- Loading branch information
1 parent
80fb5bc
commit 67e33b2
Showing
1 changed file
with
33 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf8 -*- | ||
|
||
import os | ||
import re | ||
import shutil | ||
import tarfile | ||
import tempfile | ||
import urllib.request | ||
|
||
coresdk_url = "https://github.com/4Players/odin-sdk" | ||
script_path = os.path.dirname(__file__) | ||
|
||
def get_xcframework_version(): | ||
file = open(os.path.join(script_path, "Sources", "OdinKit.swift"), "r") | ||
text = file.read() | ||
file.close() | ||
|
||
return re.findall("let version = \"([^\"]+)\"", text)[0] | ||
|
||
if __name__ == "__main__": | ||
xcframework_version = get_xcframework_version() | ||
print("Downloading Odin.xcframework version", xcframework_version) | ||
|
||
xcframework_url = coresdk_url + "/releases/download/v" + xcframework_version + "/odin-xcframework.tgz" | ||
with urllib.request.urlopen(xcframework_url) as response: | ||
with tempfile.NamedTemporaryFile(delete = True) as tmp: | ||
shutil.copyfileobj(response, tmp) | ||
tar = tarfile.open(tmp.name) | ||
tar.extractall(os.path.join(script_path, "Frameworks")) | ||
tar.close() | ||
|
||
print("All done :-)") |