1616# If not, see <https://www.gnu.org/licenses/>."""
1717# Author: Tobias Sterbak
1818
19+ import os
1920import sys
2021import zipfile
2122from io import BytesIO
@@ -35,8 +36,6 @@ def download_adb_fastboot(platform: str):
3536 )
3637 # Downloading the file by sending the request to the URL
3738 response = requests .get (url , allow_redirects = True )
38- # Split URL to get the file name
39- filename = url .split ("/" )[- 1 ]
4039
4140 # Writing the file to the local file system
4241 download_path = Path (__file__ ).parent .joinpath (Path ("tools" )).resolve ()
@@ -51,8 +50,6 @@ def download_heimdall(platform: str):
5150 url = f"https://people.ubuntu.com/~neothethird/heimdall-{ platform } .zip"
5251 # Downloading the file by sending the request to the URL
5352 response = requests .get (url , allow_redirects = True )
54- # Split URL to get the file name
55- filename = url .split ("/" )[- 1 ]
5653
5754 # Writing the file to the local file system
5855 download_path = Path (__file__ ).parent .joinpath (Path ("heimdall" )).resolve ()
@@ -63,36 +60,36 @@ def download_heimdall(platform: str):
6360
6461def move_files_to_lib ():
6562 """Move files to the expected path in the openandroidinstaller package."""
66- target_path = Path ("openandroidinstaller/ bin" , exist_ok = True )
63+ target_path = Path (os . sep . join ([ "openandroidinstaller" , " bin"]) , exist_ok = True )
6764 logger .info (f"Move executables to { target_path } ..." )
6865 target_path .mkdir (exist_ok = True )
6966 # move adb
7067 adb_path = (
71- Path (__file__ ).parent .joinpath (Path ("../ tools/ platform-tools/ adb" )).resolve ()
68+ Path (__file__ ).parent .joinpath (Path (os . sep . join ([ ".." , " tools" , " platform-tools" , " adb"]) )).resolve ()
7269 )
7370 adb_target_path = (
7471 Path (__file__ )
75- .parent .joinpath (Path ("../ openandroidinstaller/ bin/ adb" ))
72+ .parent .joinpath (Path (os . sep . join ([ ".." , " openandroidinstaller" , " bin" , " adb"]) ))
7673 .resolve ()
7774 )
7875 adb_path .rename (adb_target_path )
7976 # move fastboot
8077 fb_path = (
8178 Path (__file__ )
82- .parent .joinpath (Path ("../ tools/ platform-tools/ fastboot" ))
79+ .parent .joinpath (Path (os . sep . join ([ ".." , " tools" , " platform-tools" , " fastboot"]) ))
8380 .resolve ()
8481 )
8582 fb_target_path = (
8683 Path (__file__ )
87- .parent .joinpath (Path ("../ openandroidinstaller/ bin/ fastboot" ))
84+ .parent .joinpath (Path (os . sep . join ([ ".." , " openandroidinstaller" , " bin" , " fastboot"]) ))
8885 .resolve ()
8986 )
9087 fb_path .rename (fb_target_path )
9188 # move heimdall
92- hd_path = Path (__file__ ).parent .joinpath (Path ("../ heimdall/ heimdall" )).resolve ()
89+ hd_path = Path (__file__ ).parent .joinpath (Path (os . sep . join ([ ".." , " heimdall" , " heimdall"]) )).resolve ()
9390 hd_target_path = (
9491 Path (__file__ )
95- .parent .joinpath (Path ("../ openandroidinstaller/ bin/ heimdall" ))
92+ .parent .joinpath (Path (os . sep . join ([ ".." , " openandroidinstaller" , " bin" , " heimdall"]) ))
9693 .resolve ()
9794 )
9895 hd_path .rename (hd_target_path )
0 commit comments