Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small Fixes #113

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions skare3_tools/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,21 +167,18 @@ def wrapper(*args, update=False, **kwargs):
if update_policy is not None and result is not None:
update = update or update_policy(filename, result)
if not dir_access_ok(filename):
if result is None:
raise Exception(
f"No write access to cache file {filename} and no cached value"
)
logging.getLogger("skare3").debug(
f"No write access to cache file {filename}"
)
update = False
if result is None or update:
result = func(*args, **kwargs)
directory_out = os.path.dirname(filename)
if not os.path.exists(directory_out):
os.makedirs(directory_out)
with open(filename, "w") as file:
json.dump(result, file)
if update:
directory_out = os.path.dirname(filename)
if not os.path.exists(directory_out):
os.makedirs(directory_out)
with open(filename, "w") as file:
json.dump(result, file)
return result

def clear_cache():
Expand Down
2 changes: 1 addition & 1 deletion skare3_tools/scripts/skare3_release_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def main():
] # versions can be git refs like refs/tags/V2
# regular expression (mostly) matching PEP-0440 version format
fmt = (
r"(?P<final_version>((?P<epoch>[0-9]+)!)?(?P<release>[0-9]+(.[0-9]+(.[0-9]+)?)?))"
r"(?P<final_version>((?P<epoch>[0-9]+)!)?(?P<release>[0-9]+(\.[0-9]+(\.[0-9]+)?)?))"
r"((a|b|rc)(?P<rc>[0-9]+))?(\+(?P<label>[a-zA-Z]+))?$"
)
version_info = re.match(fmt, tag_name)
Expand Down
11 changes: 10 additions & 1 deletion skare3_tools/scripts/skare3_update_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ class ArgumentException(Exception):

class CondaException(Exception):
def __init__(self, info):
super().__init__(info["message"])
if "message" in info:
msg = info["message"]
elif "error" in info:
msg = info["error"]
trace = [line for line in info.get("traceback", []).split("\n") if line]
msg += "\n"
msg += trace[-1]
else:
msg = "Unknown error"
super().__init__(msg)
self.info = info


Expand Down