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

refactor(utils): make OSPlatform a dataclass #1298

Merged
merged 1 commit into from
Sep 29, 2023
Merged
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
13 changes: 10 additions & 3 deletions charmcraft/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# For further info, check https://github.com/canonical/charmcraft

"""Collection of utilities for charmcraft."""

import datetime
import enum
import functools
Expand All @@ -28,7 +27,7 @@
import subprocess
import sys
import zipfile
from collections import defaultdict, namedtuple
from collections import defaultdict
from dataclasses import dataclass
from stat import S_IRGRP, S_IROTH, S_IRUSR, S_IXGRP, S_IXOTH, S_IXUSR
from typing import (
Expand All @@ -52,7 +51,15 @@
from charmcraft.env import is_charmcraft_running_in_managed_mode
from charmcraft.errors import DuplicateCharmsError, InvalidCharmPathError

OSPlatform = namedtuple("OSPlatform", "system release machine")

@dataclass(frozen=True)
class OSPlatform:
"""Description of an operating system platform."""

system: str
release: str
machine: str


# handy masks for execution and reading for everybody
S_IXALL = S_IXUSR | S_IXGRP | S_IXOTH
Expand Down