From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!aioe.org!pMM5B9Rl/1LQCd+Nt14ETA.user.46.165.242.91.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio) Date: Fri, 11 Nov 2022 14:40:14 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com> <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: gioia.aioe.org; logging-data="20988"; posting-host="pMM5B9Rl/1LQCd+Nt14ETA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org"; User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 X-Notice: Filtered by postfilter v. 0.9.2 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:64602 List-Id: On 2022-11-11 14:30, Dmitry A. Kazakov wrote: > On 2022-11-11 12:28, Rego, P. wrote: > >> Got it. I didn't include naming and compiler options. >> Now it runs, but it asks for a linker >>> gprbuild: no linker specified and no default linker in the configuration >> (where idk if it makes sense since we wont be linking to an object) >> >> For a no error py it "compiles" clean (ok I'll call compilation, but >> we understand >> it's not "the compilation"), but in compilation log it doesn't show >> the warnings >> that are included in the edit window with the opened file. If I include >> an error, it shows in the log where the error happened, but doesn't >> show in >> the locations. GPS will be not very useful this way. > > This "compiles" only: > > project Python is >    for Languages use ("Python"); >    package Compiler is >       for Driver ("Python") use > "C:/GNAT/2021/libexec/gnatstudio/gnathub/share/gnathub/python/python.exe"; >       for Required_Switches ("Python") use ("-m", "py_compile"); >    end Compiler; >    package Naming is >       for Body_Suffix ("Python") use ".py"; >    end Naming; > end Python; > > It should show syntax errors. If you remove -m py_compile switches, then > it will "compile" and execute. > > (Python is not the thing you would wish to use in an IDE or anywhere, > pretty much consistently so... (:-)) Forgot to mention. If you want to create an executable. You can try to configure the package Linker using PyInstaller as the driver: https://pyinstaller.org/en/stable/operating-mode.html Note that Linker does not take language e.g. ("Python") you just write: package Linker is for Driver use "pyinstaller.exe"; You have to tinker a bit since there is no object files to feed the Linker. Maybe you could sell it *.py as an "archive" (static library). Whatever... (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de