Skip to content

Commit

Permalink
Update MESA download URLs and add optional text parameter in Download…
Browse files Browse the repository at this point in the history
… class
  • Loading branch information
gautam-404 committed Mar 20, 2024
1 parent eeea97e commit 57cbb9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
5 changes: 4 additions & 1 deletion mesaport/Installer/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __init__(self, directory, version, ostype):
Args:
ver (str): Version of MESA to install.
directory (str): Path to the directory where the MESA SDK and MESA zip files will be downloaded.
ostype (str): Operating system type.
"""
self.ostype = ostype
self.directory = directory
Expand Down Expand Up @@ -56,13 +57,15 @@ def check_n_download(self, filepath, url, text="Downloading..."):
Args:
filepath (str): Path to the file to be downloaded.
url (str): URL of the file to be downloaded.
text (str, optional): Text to be displayed while downloading the file. Defaults to "Downloading...".
"""
headers = {
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0",
}
response = requests.get(url, headers=headers, stream=True)
response.raise_for_status()
total = float(response.headers.get('content-length', 0))
# total = float(response.headers.get('content-length', 0))
total = float(response.headers.get('content-length', 0)) if response.headers.get('content-length') else 0
if os.path.exists(filepath) and total == os.path.getsize(filepath):
print(text)
print("[blue]File already downloaded. Skipping download.[/blue]\n")
Expand Down
19 changes: 12 additions & 7 deletions mesaport/Installer/mesaurls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
mac_intel_versions = ["latest", "r23.05.1", "r22.11.1", "r22.05.1", "r21.12.1", "r15140", "r12778"]
mac_arm_versions = ["latest", "r23.05.1", "r22.11.1", "r22.05.1"]

mesa_urls = {"latest": "https://github.com/MESAHub/mesa/archive/refs/tags/r24.03.1.zip",
"r24.03.1": "https://github.com/MESAHub/mesa/archive/refs/tags/r24.03.1.zip",
"r23.05.1": "https://github.com/MESAHub/mesa/archive/refs/tags/r23.05.1.zip",
"r22.11.1": "https://github.com/MESAHub/mesa/archive/refs/tags/r22.11.1.zip",
"r22.05.1": "https://github.com/MESAHub/mesa/archive/refs/tags/r22.05.1.zip",
"r21.12.1": "https://github.com/MESAHub/mesa/archive/refs/tags/r21.12.1.zip",
"r15140": "https://github.com/MESAHub/mesa/archive/refs/tags/r15140.zip",
mesa_urls = {"latest": "https://codeload.github.com/MESAHub/mesa/zip/refs/tags/r24.03.1",
"r24.03.1": "https://codeload.github.com/MESAHub/mesa/zip/refs/tags/r24.03.1",
"r23.05.1": "https://codeload.github.com/MESAHub/mesa/zip/refs/tags/r23.05.1",
"r22.11.1": "https://codeload.github.com/MESAHub/mesa/zip/refs/tags/r22.11.1",
"r22.05.1": "https://codeload.github.com/MESAHub/mesa/zip/refs/tags/r22.05.1",
"r21.12.1": "https://codeload.github.com/MESAHub/mesa/zip/refs/tags/r21.12.1",
"r15140": "https://codeload.github.com/MESAHub/mesa/zip/refs/tags/r15140",
# "r23.05.1": "https://github.com/MESAHub/mesa/archive/refs/tags/r23.05.1.zip",
# "r22.11.1": "https://github.com/MESAHub/mesa/archive/refs/tags/r22.11.1.zip",
# "r22.05.1": "https://github.com/MESAHub/mesa/archive/refs/tags/r22.05.1.zip",
# "r21.12.1": "https://github.com/MESAHub/mesa/archive/refs/tags/r21.12.1.zip",
# "r15140": "https://github.com/MESAHub/mesa/archive/refs/tags/r15140.zip",
"r12778": "https://zenodo.org/record/7319739/files/mesa-r12778.zip"}


Expand Down

0 comments on commit 57cbb9d

Please sign in to comment.