From: John Snow <jsnow@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH 1/3] scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol
Date: Fri, 24 Jul 2020 12:51:22 -0400 [thread overview]
Message-ID: <11e45be0-e37b-00e2-2880-1e3bd55461ee@redhat.com> (raw)
In-Reply-To: <20200723142738.1868568-2-armbru@redhat.com>
On 7/23/20 10:27 AM, Markus Armbruster wrote:
> Commit c7b942d7f8 "scripts/qmp: Fix shebang and imports" messed with
> it for reasons I don't quite understand. I do understand how it fails
> now: it neglects to import sys. Fix that.
>
Apologies. These scripts didn't appear to work because they don't have
any clue where the script they are trying to import lives. I was working
on a series that refactored ./python/qemu into a python package.
The back half of that series hasn't landed upstream yet, so the import
refuddling looks an awful lot more arbitrary at the moment, but the idea
is that the scripts SHOULD work without needing to explicitly set your
PYTHONPATH. For the moment, I think that's better.
My ultimate end-game is to get most python scripts under ./python/ and
checked with pylint/mypy etc. as it will help detect breaking changes if
library routines change. I want to institute a tree-wide regime for
python code management that has a unified vision about how imports work
and so on.
I would hope that this would reduce confusion in the future about how to
execute scripts, how to write import statements, etc.
Most of what I am doing is baby steps towards that.
> It now fails because it expects an old version of module fuse. That's
> next.
>
See also my commit message: "There's more wrong with these scripts; ..."
> Fixes: c7b942d7f84ef54f266921bf7668d43f1f2c7c79
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Thanks:
Reviewed-by: John Snow <jsnow@redhat.com>
> ---
> scripts/qmp/qom-fuse | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse
> index 5fa6b3bf64..b7dabe8d65 100755
> --- a/scripts/qmp/qom-fuse
> +++ b/scripts/qmp/qom-fuse
> @@ -13,7 +13,7 @@
>
> import fuse, stat
> from fuse import Fuse
> -import os, posix
> +import os, posix, sys
> from errno import *
>
> sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
> @@ -134,7 +134,7 @@ class QOMFS(Fuse):
> yield fuse.Direntry(str(item['name']))
>
> if __name__ == '__main__':
> - import sys, os
> + import os
>
> fs = QOMFS(QEMUMonitorProtocol(os.environ['QMP_SOCKET']))
> fs.main(sys.argv)
>
next prev parent reply other threads:[~2020-07-24 16:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 14:27 [PATCH 0/3] scripts/qmp/qom-fuse: Scrape off the bitrot Markus Armbruster
2020-07-23 14:27 ` [PATCH 1/3] scripts/qmp/qom-fuse: Unbreak import of QEMUMonitorProtocol Markus Armbruster
2020-07-23 15:08 ` Philippe Mathieu-Daudé
2020-07-24 16:51 ` John Snow [this message]
2020-07-23 14:27 ` [PATCH 2/3] scripts/qmp/qom-fuse: Port to current Python module fuse Markus Armbruster
2020-07-24 16:56 ` John Snow
2020-07-27 7:09 ` Markus Armbruster
2020-07-23 14:27 ` [PATCH 3/3] scripts/qmp/qom-fuse: Fix getattr(), read() for files in / Markus Armbruster
2020-07-23 15:10 ` Philippe Mathieu-Daudé
2020-07-24 7:00 ` Markus Armbruster
2020-07-24 16:58 ` John Snow
2020-07-23 15:21 ` [PATCH 0/3] scripts/qmp/qom-fuse: Scrape off the bitrot Thomas Huth
2020-07-24 7:33 ` Status of scripts/qmp/ (was: [PATCH 0/3] scripts/qmp/qom-fuse: Scrape off the bitrot) Markus Armbruster
2020-07-24 8:10 ` Thomas Huth
2020-07-24 16:53 ` [PATCH 0/3] scripts/qmp/qom-fuse: Scrape off the bitrot John Snow
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=11e45be0-e37b-00e2-2880-1e3bd55461ee@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).