blob: 8fdfee6e584541510d26f75b5686d46ce3db1fbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# SPDX-License-Identifier: Apache-2.0
# Copyright 2012-2021 The Meson development team
# Copyright © 2021-2023 Intel Corporation
from __future__ import annotations
"""base classes providing no-op functionality.."""
import enum
import os
import typing as T
from .. import mlog
__all__ = ['DirectoryLock', 'DirectoryLockAction', 'DirectoryLockBase']
class DirectoryLockAction(enum.Enum):
IGNORE = 0
WAIT = 1
FAIL = 2
class DirectoryLockBase:
def __init__(self, directory: str, lockfile: str, action: DirectoryLockAction, err: str) -> None:
self.action = action
self.err = err
self.lockpath = os.path.join(directory, lockfile)
def __enter__(self) -> None:
mlog.debug('Calling the no-op version of DirectoryLock')
def __exit__(self, *args: T.Any) -> None:
pass
class DirectoryLock(DirectoryLockBase):
pass
|