Skip to content

Commit

Permalink
#113 implement fallback code if executed on python2
Browse files Browse the repository at this point in the history
  • Loading branch information
CAMOBAP committed Aug 28, 2023
1 parent 517087d commit 0f7fac9
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions inkscape-setup-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,27 @@ runs:
win_prefix = "C:\\Program Files\\Inkscape\\bin"
def get_platform_name():
def os_release():
try:
os_release_id = platform.freedesktop_os_release()["ID"]
return "Ubuntu" if os_release_id == "Ubuntu" else platform.system()
return platform.freedesktop_os_release()
except AttributeError:
return platform.system()
properties = {}
try:
with open("/etc/os-release", "r") as file:
for line in file:
line = line.strip()
if line and not line.startswith("#"):
key, value = line.split("=", 1)
properties[key] = value.strip('"')
except:
pass
return properties
platform_name = get_platform_name()
os_release_dict = os_release()
print(os_release_dict)
platform_name = "Ubuntu" if os_release_dict.get("ID", None) == "ubuntu" else platform.system()
cmds = {
"Darwin": [ "HOMEBREW_CASK_OPTS='--no-quarantine' brew install --cask inkscape", "inkscape --version" ],
Expand Down

0 comments on commit 0f7fac9

Please sign in to comment.