qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Mateusz Krawczuk <mat.krawczuk@gmail.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2] Add information how to fix common build error on Windows in symlink-install-tree
Date: Wed, 17 May 2023 12:55:16 -0400	[thread overview]
Message-ID: <CAFn=p-aKy7onDCH7bQyvcS3jXngcQAF0K_zrkZorePxdA4s1xA@mail.gmail.com> (raw)
In-Reply-To: <20230504211101.1386-1-mat.krawczuk@gmail.com>

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
>



  reply	other threads:[~2023-05-17 16:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 21:11 [PATCH v2] Add information how to fix common build error on Windows in symlink-install-tree Mateusz Krawczuk
2023-05-17 16:55 ` John Snow [this message]
2023-05-18  7:16 ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFn=p-aKy7onDCH7bQyvcS3jXngcQAF0K_zrkZorePxdA4s1xA@mail.gmail.com' \
    --to=jsnow@redhat.com \
    --cc=berrange@redhat.com \
    --cc=crosa@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mat.krawczuk@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).