-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2900 from SasView/release_6_into_main
Merge release_6.0.0 branch into main
- Loading branch information
Showing
104 changed files
with
16,478 additions
and
2,523 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
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
Copyright (c) 2009-2023, SasView Developers | ||
|
||
Copyright (c) 2009-2024, SasView Developers | ||
|
||
All rights reserved. | ||
|
||
|
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,52 @@ | ||
import requests | ||
from enum import Enum | ||
|
||
class OS(Enum): | ||
WIN = 0 | ||
LINUX = 1 | ||
MAC = 2 | ||
UNKNOWN = 3 | ||
|
||
def get_os(): | ||
""" | ||
Get the operating system of the current machine. | ||
""" | ||
import platform | ||
if platform.system() == "Windows": | ||
return OS.WIN | ||
elif platform.system() == "Linux": | ||
return OS.LINUX | ||
elif platform.system() == "Darwin": | ||
return OS.MAC | ||
return OS.UNKNOWN | ||
|
||
def get_ausaxs(): | ||
_os = get_os() | ||
url = "https://github.com/SasView/AUSAXS/releases/latest/download/" | ||
libs = None | ||
if _os == OS.WIN: | ||
libs = ["libausaxs.dll"] | ||
elif _os == OS.LINUX: | ||
libs = ["libausaxs.so"] | ||
elif _os == OS.MAC: | ||
libs = ["libausaxs.dylib"] | ||
if libs is not None: | ||
# we have to use a relative path since the package is not installed yet | ||
base_loc = "src/sas/sascalc/calculator/ausaxs/lib/" | ||
for lib in libs: | ||
response = requests.get(url+lib) | ||
|
||
# disable macos for now by renaming the local file | ||
if _os is OS.MAC: | ||
lib = "libausaxs.dylib" | ||
|
||
with open(base_loc+lib, "wb") as f: | ||
f.write(response.content) | ||
|
||
def fetch_external_dependencies(): | ||
#surround with try/except to avoid breaking the build if the download fails | ||
try: | ||
get_ausaxs() | ||
except Exception as e: | ||
print("Download of external dependencies failed.", e) | ||
return |
Oops, something went wrong.