-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using pre-installed downloader when available.
- Loading branch information
1 parent
e8d3067
commit 4ccb78a
Showing
6 changed files
with
55 additions
and
20 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 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,38 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) 2022-2024 José Manuel Barroso Galindo <[email protected]> | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
|
||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
|
||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
# You can download the latest version of this tool from: | ||
# https://github.com/theypsilon/Update_All_MiSTer | ||
|
||
|
||
from update_all.os_utils import OsUtils | ||
from update_all.constants import DOWNLOADER_URL, DOWNLOADER_LATEST_ZIP_PATH | ||
from update_all.file_system import FileSystem | ||
from typing import Optional | ||
|
||
|
||
def prepare_latest_downloader(os_utils: OsUtils, file_system: FileSystem) -> Optional[str]: | ||
if file_system.is_file(DOWNLOADER_LATEST_ZIP_PATH): | ||
temp_file = file_system.temp_file_by_id('downloader.sh') | ||
file_system.copy(DOWNLOADER_LATEST_ZIP_PATH, temp_file.name) | ||
return temp_file.name | ||
else: | ||
content = os_utils.download(DOWNLOADER_URL) | ||
if content is None: | ||
return None | ||
|
||
temp_file = file_system.temp_file_by_id('downloader.sh') | ||
file_system.write_file_bytes(temp_file.name, content) | ||
return temp_file.name |
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 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 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 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