Skip to content

Commit

Permalink
refactor(utils): make OSPlatform a dataclass
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau committed Sep 29, 2023
1 parent 8b79757 commit 8669945
Showing 1 changed file with 10 additions and 3 deletions.
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

0 comments on commit 8669945

Please sign in to comment.