diff options
author | Christian Tismer <tismer@stackless.com> | 2022-03-30 12:24:04 +0200 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2022-03-30 16:46:18 +0200 |
commit | 1a399495fe46013b35eb263761009de8940aa6f0 (patch) | |
tree | f8838341079743de3b26f266f9be6dc2d695e7c7 | |
parent | 8653e05b2d8db6215a5e809be09d38ab675d83f8 (diff) |
setup: re-enable shiboken6-genpyi after total embedding
The script shiboken6-genpyi did not work any longer, after
we turned all Python modules into embedded, source-less
versions.
It is no longer possible to access a Python source file
from the FS after shiboken was built. The only way is
access via import, which is intentioned.
The executable code of gyi_generate.py needed to be moved
into function main, to make it importable instead of
always executing.
Change-Id: I4632bbbe5858fb284158ef3101223ccd5ba8f362
Pick-to: 6.2
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rwxr-xr-x | sources/shiboken6/shiboken_tool.py | 10 | ||||
-rw-r--r-- | sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/sources/shiboken6/shiboken_tool.py b/sources/shiboken6/shiboken_tool.py index e136794f7..8c7a517e5 100755 --- a/sources/shiboken6/shiboken_tool.py +++ b/sources/shiboken6/shiboken_tool.py @@ -53,10 +53,12 @@ def main(): def genpyi(): - shiboken_dir = Path(__file__).resolve().parents[2] / "shiboken6" - support = shiboken_dir / "files.dir" / "shibokensupport" - cmd = support / "signature" / "lib" / "pyi_generator.py" - command = [sys.executable, os.fspath(cmd)] + sys.argv[1:] + # After we changed the shibokensupport module to be totally virtual, + # it is no longer possible to call the pyi generator from the file system. + command = [sys.executable, "-c", + "import shiboken6;" + "from shibokensupport.signature.lib.pyi_generator import main;" + "main()"] + sys.argv[1:] sys.exit(subprocess.call(command)) diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py index d6e006902..aed6a6f46 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py @@ -308,7 +308,7 @@ def generate_pyi(import_name, outpath, options): subprocess.check_output([sys.executable, os.fspath(outfilepath)]) -if __name__ == "__main__": +def main(): parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description=dedent("""\ @@ -342,4 +342,6 @@ if __name__ == "__main__": options.logger = logger generate_pyi(module, outpath, options=options) +if __name__ == "__main__": + main() # eof |