aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorD Scott Phillips <d.scott.phillips@intel.com>2020-06-02 21:20:52 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2020-06-10 01:09:16 +0300
commitf6a842821b64653de042633e714af3c5a5326c29 (patch)
tree7fb14578041f11fde188d162e399ca2f509fbad6 /mesonbuild/interpreter.py
parent5663b4a3e8507199318965132cdc9cc53a59da80 (diff)
downloadmeson-f6a842821b64653de042633e714af3c5a5326c29.zip
meson-f6a842821b64653de042633e714af3c5a5326c29.tar.gz
meson-f6a842821b64653de042633e714af3c5a5326c29.tar.bz2
Fix python3 installed from the Windows Store
When meson is currently being run with a python that seems to have been installed from the Windows Store, replace the general WindowsApps directory in search paths with dirname(sys.executable), and also handle failures with pathlib.resolve on WindowsApps exe files.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index b8d4fec..76dbebd 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -41,6 +41,7 @@ import shutil
import uuid
import re
import shlex
+import stat
import subprocess
import collections
import functools
@@ -2512,7 +2513,19 @@ class Interpreter(InterpreterBase):
elif os.path.isfile(f) and not f.startswith('/dev'):
srcdir = Path(self.environment.get_source_dir())
builddir = Path(self.environment.get_build_dir())
- f = Path(f).resolve()
+ try:
+ f = Path(f).resolve()
+ except OSError:
+ f = Path(f)
+ s = f.stat()
+ if (hasattr(s, 'st_file_attributes') and
+ s.st_file_attributes & stat.FILE_ATTRIBUTE_REPARSE_POINT != 0 and
+ s.st_reparse_tag == stat.IO_REPARSE_TAG_APPEXECLINK):
+ # This is a Windows Store link which we can't
+ # resolve, so just do our best otherwise.
+ f = f.parent.resolve() / f.name
+ else:
+ raise
if builddir in f.parents:
return
if srcdir in f.parents: