diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | mesonbuild/wrap/wrap.py | 16 | ||||
| -rw-r--r-- | test cases/failing/33 non-root subproject/test.json | 2 | ||||
| -rw-r--r-- | test cases/failing/73 subproj dependency not-found and required/test.json | 2 |
4 files changed, 17 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore index 8ff5e7869..e04aa0dad 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ __pycache__ *~ *.swp packagecache +.wraplock /MANIFEST /build /dist diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index aae1c9d2c..c8eff6988 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -30,7 +30,10 @@ from functools import lru_cache from . import WrapMode from .. import coredata -from ..mesonlib import quiet_git, GIT, ProgressBar, MesonException, windows_proof_rmtree, Popen_safe +from ..mesonlib import ( + DirectoryLock, DirectoryLockAction, quiet_git, GIT, ProgressBar, MesonException, + windows_proof_rmtree, Popen_safe +) from ..interpreterbase import FeatureNew from ..interpreterbase import SubProject from .. import mesonlib @@ -449,7 +452,7 @@ class Resolver: return wrap_name return None - def resolve(self, packagename: str, force_method: T.Optional[Method] = None) -> T.Tuple[str, Method]: + def _resolve(self, packagename: str, force_method: T.Optional[Method] = None) -> T.Tuple[str, Method]: wrap = self.wraps.get(packagename) if wrap is None: wrap = self.get_from_wrapdb(packagename) @@ -547,6 +550,15 @@ class Resolver: self.wrap.update_hash_cache(self.dirname) return rel_path, method + def resolve(self, packagename: str, force_method: T.Optional[Method] = None) -> T.Tuple[str, Method]: + try: + with DirectoryLock(self.subdir_root, '.wraplock', + DirectoryLockAction.WAIT, + 'Failed to lock subprojects directory'): + return self._resolve(packagename, force_method) + except FileNotFoundError: + raise WrapNotFoundException('Attempted to resolve subproject without subprojects directory present.') + def check_can_download(self) -> None: # Don't download subproject data based on wrap file if requested. # Git submodules are ok (see above)! diff --git a/test cases/failing/33 non-root subproject/test.json b/test cases/failing/33 non-root subproject/test.json index 52baf6a65..d379a4334 100644 --- a/test cases/failing/33 non-root subproject/test.json +++ b/test cases/failing/33 non-root subproject/test.json @@ -1,7 +1,7 @@ { "stdout": [ { - "line": "test cases/failing/33 non-root subproject/some/meson.build:1:0: ERROR: Neither a subproject directory nor a someproj.wrap file was found." + "line": "test cases/failing/33 non-root subproject/some/meson.build:1:0: ERROR: Attempted to resolve subproject without subprojects directory present." } ] } diff --git a/test cases/failing/73 subproj dependency not-found and required/test.json b/test cases/failing/73 subproj dependency not-found and required/test.json index 11ab0318b..e79e28429 100644 --- a/test cases/failing/73 subproj dependency not-found and required/test.json +++ b/test cases/failing/73 subproj dependency not-found and required/test.json @@ -1,7 +1,7 @@ { "stdout": [ { - "line": "test cases/failing/73 subproj dependency not-found and required/meson.build:2:10: ERROR: Neither a subproject directory nor a missing.wrap file was found." + "line": "test cases/failing/73 subproj dependency not-found and required/meson.build:2:10: ERROR: Attempted to resolve subproject without subprojects directory present." } ] } |
