scripts/symlink-install-tree.py | 5 +++++ 1 file changed, 5 insertions(+)
By default, Windows doesn't allow to create soft links for user account and only administrator is allowed to do this. To fix this problem you have to raise your permissions or enable Developer Mode, which available since Windows 10. Additional explanation when build fails will allow developer to fix the problem on his computer faster.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1386
Signed-off-by: Mateusz Krawczuk <mat.krawczuk@gmail.com>
v2:
Removed unnecessary newlines to be consistent with QEMU coding styles.
Signed-off-by: Mateusz Krawczuk <mat.krawczuk@gmail.com>
---
scripts/symlink-install-tree.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/symlink-install-tree.py b/scripts/symlink-install-tree.py
index 67cb86dd52..62fd609f32 100644
--- a/scripts/symlink-install-tree.py
+++ b/scripts/symlink-install-tree.py
@@ -7,12 +7,14 @@
import subprocess
import sys
+
def destdir_join(d1: str, d2: str) -> str:
if not d1:
return d2
# c:\destdir + c:\prefix must produce c:\destdir\prefix
return str(PurePath(d1, *PurePath(d2).parts[1:]))
+
introspect = os.environ.get('MESONINTROSPECT')
out = subprocess.run([*introspect.split(' '), '--installed'],
stdout=subprocess.PIPE, check=True).stdout
@@ -28,5 +30,8 @@ def destdir_join(d1: str, d2: str) -> str:
os.symlink(source, bundle_dest)
except BaseException as e:
if not isinstance(e, OSError) or e.errno != errno.EEXIST:
+ if os.name == 'nt':
+ print('Please enable Developer Mode to support soft link '
+ 'without Administrator permission')
print(f'error making symbolic link {dest}', file=sys.stderr)
raise e
--
2.40.1
05.05.2023 00:11, Mateusz Krawczuk wrote:
..
> except BaseException as e:
> if not isinstance(e, OSError) or e.errno != errno.EEXIST:
> + if os.name == 'nt':
> + print('Please enable Developer Mode to support soft link '
> + 'without Administrator permission')
> print(f'error making symbolic link {dest}', file=sys.stderr)
> raise e
FWIW, can't we get rid of symlinks entirely? It smells like this
should be possible with meson.
/mjt
On Thu, May 4, 2023 at 5:11 PM Mateusz Krawczuk <mat.krawczuk@gmail.com> wrote:
>
> By default, Windows doesn't allow to create soft links for user account and only administrator is allowed to do this. To fix this problem you have to raise your permissions or enable Developer Mode, which available since Windows 10. Additional explanation when build fails will allow developer to fix the problem on his computer faster.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1386
> Signed-off-by: Mateusz Krawczuk <mat.krawczuk@gmail.com>
>
> v2:
> Removed unnecessary newlines to be consistent with QEMU coding styles.
I don't think you actually did this, but it's maybe fine. If you
wanted to be careful about it, you could use pylint and flake8 to
check the formatting of this script, though it isn't perfect to start:
jsnow@scv ~/s/q/scripts (python-socket-connect)> pylint symlink-install-tree.py
************* Module symlink-install-tree
symlink-install-tree.py:1:0: C0114: Missing module docstring
(missing-module-docstring)
symlink-install-tree.py:1:0: C0103: Module name "symlink-install-tree"
doesn't conform to snake_case naming style (invalid-name)
symlink-install-tree.py:10:0: C0116: Missing function or method
docstring (missing-function-docstring)
symlink-install-tree.py:10:17: C0103: Argument name "d1" doesn't
conform to snake_case naming style (invalid-name)
symlink-install-tree.py:10:26: C0103: Argument name "d2" doesn't
conform to snake_case naming style (invalid-name)
symlink-install-tree.py:29:11: W0703: Catching too general exception
BaseException (broad-except)
symlink-install-tree.py:30:41: E1101: Instance of 'BaseException' has
no 'errno' member (no-member)
jsnow@scv ~/s/q/scripts (python-socket-connect) [22]> flake8
symlink-install-tree.py
symlink-install-tree.py:10:1: E302 expected 2 blank lines, found 1
symlink-install-tree.py:16:1: E305 expected 2 blank lines after class
or function definition, found 1
jsnow@scv ~/s/q/scripts (python-socket-connect) [1]> isort -c
symlink-install-tree.py
ERROR: /home/jsnow/src/qemu/scripts/symlink-install-tree.py Imports
are incorrectly sorted and/or formatted.
As long as you don't make the spacing *worse*, it's fine - but any
fixes to existing code should go in its own patch.
> Signed-off-by: Mateusz Krawczuk <mat.krawczuk@gmail.com>
> ---
> scripts/symlink-install-tree.py | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/scripts/symlink-install-tree.py b/scripts/symlink-install-tree.py
> index 67cb86dd52..62fd609f32 100644
> --- a/scripts/symlink-install-tree.py
> +++ b/scripts/symlink-install-tree.py
> @@ -7,12 +7,14 @@
> import subprocess
> import sys
>
> +
> def destdir_join(d1: str, d2: str) -> str:
> if not d1:
> return d2
> # c:\destdir + c:\prefix must produce c:\destdir\prefix
> return str(PurePath(d1, *PurePath(d2).parts[1:]))
>
> +
> introspect = os.environ.get('MESONINTROSPECT')
> out = subprocess.run([*introspect.split(' '), '--installed'],
> stdout=subprocess.PIPE, check=True).stdout
> @@ -28,5 +30,8 @@ def destdir_join(d1: str, d2: str) -> str:
> os.symlink(source, bundle_dest)
> except BaseException as e:
> if not isinstance(e, OSError) or e.errno != errno.EEXIST:
> + if os.name == 'nt':
> + print('Please enable Developer Mode to support soft link '
> + 'without Administrator permission')
Use file=sys.stderr here, too, though. If you resubmitted a patch that
omitted all whitespace changes and fixed this part, I think that'd be
sufficient. Thanks for the patch!
--js
> print(f'error making symbolic link {dest}', file=sys.stderr)
> raise e
> --
> 2.40.1
>
© 2016 - 2026 Red Hat, Inc.