Extensions: pass platform to the remote URL
Add the platform to the URL when connecting to the remote server. Based on !122234. Co-authored-by: Dalai Felinto <dalai@blender.org> ---- This follows documented platform ID's from: https://docs.blender.org/manual/nb/dev/advanced/extensions/getting_started.html Co-authored-by: Dalai Felinto <dalai@blender.org> Pull Request: https://projects.blender.org/blender/blender/pulls/122371
This commit is contained in:
parent
905aaf439c
commit
be4788a9bd
@ -25,6 +25,7 @@ __all__ = (
|
||||
|
||||
# Public Stand-Alone Utilities.
|
||||
"pkg_theme_file_list",
|
||||
"platform_from_this_system",
|
||||
"url_params_append_for_blender",
|
||||
"file_mtime_or_none",
|
||||
|
||||
@ -278,6 +279,23 @@ def pkg_theme_file_list(directory: str, pkg_idname: str) -> Tuple[str, List[str]
|
||||
return theme_dir, theme_files
|
||||
|
||||
|
||||
def platform_from_this_system() -> str:
|
||||
import platform
|
||||
system_replace = {
|
||||
"darwin": "macos",
|
||||
}
|
||||
machine_replace = {
|
||||
"x86_64": "x64",
|
||||
"amd64": "x64",
|
||||
}
|
||||
system = platform.system().lower()
|
||||
machine = platform.machine().lower()
|
||||
return "{:s}-{:s}".format(
|
||||
system_replace.get(system, system),
|
||||
machine_replace.get(machine, machine),
|
||||
)
|
||||
|
||||
|
||||
def _url_params_append(url: str, params: Dict[str, str]) -> str:
|
||||
import urllib
|
||||
import urllib.parse
|
||||
@ -319,6 +337,7 @@ def url_params_append_for_blender(url: str, blender_version: Tuple[int, int, int
|
||||
return url
|
||||
|
||||
params = {
|
||||
"platform": platform_from_this_system(),
|
||||
"blender_version": "{:d}.{:d}.{:d}".format(*blender_version),
|
||||
}
|
||||
return _url_params_append(url, params)
|
||||
|
Loading…
Reference in New Issue
Block a user