Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Brain fried -- Core dumped


devel / comp.lang.ada / Re: Running Python code from GPRBuild (Calling from GNAT Studio)

SubjectAuthor
* Running Python code from GPRBuild (Calling from GNAT Studio)Rego, P.
+* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Dmitry A. Kazakov
|`* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Rego, P.
| `* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Dmitry A. Kazakov
|  `* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Rego, P.
|   +* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Dmitry A. Kazakov
|   |+* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Dmitry A. Kazakov
|   ||`- Re: Running Python code from GPRBuild (Calling from GNAT Studio)Rego, P.
|   |`* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Rego, P.
|   | `* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Dmitry A. Kazakov
|   |  `- Re: Running Python code from GPRBuild (Calling from GNAT Studio)Rego, P.
|   `* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Egil H H
|    `* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Rego, P.
|     `* Re: Running Python code from GPRBuild (Calling from GNAT Studio)Egil H H
|      `- Re: Running Python code from GPRBuild (Calling from GNAT Studio)Rego, P.
`- Re: Running Python code from GPRBuild (Calling from GNAT Studio)Stephen Leake

1
Running Python code from GPRBuild (Calling from GNAT Studio)

<7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8997&group=comp.lang.ada#8997

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:5ca4:0:b0:4bb:fa37:866 with SMTP id q4-20020ad45ca4000000b004bbfa370866mr52624131qvh.22.1668108342971;
Thu, 10 Nov 2022 11:25:42 -0800 (PST)
X-Received: by 2002:a05:622a:429b:b0:3a5:2a82:7742 with SMTP id
cr27-20020a05622a429b00b003a52a827742mr43270133qtb.524.1668108342780; Thu, 10
Nov 2022 11:25:42 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 10 Nov 2022 11:25:42 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=152.249.156.27; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu
NNTP-Posting-Host: 152.249.156.27
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
Subject: Running Python code from GPRBuild (Calling from GNAT Studio)
From: pvrego@gmail.com (Rego, P.)
Injection-Date: Thu, 10 Nov 2022 19:25:42 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1955
 by: Rego, P. - Thu, 10 Nov 2022 19:25 UTC

Hello everyone, long time no see some of you, I hope everyone is fine.

I'm trying to compile some Python files from an Ada project (in an integration which will consist of Ada, Python and Rust). But let's simplify the things, so I created a Python-only project using this :

-- testpy.gpr
project Testpy is
for Source_Dirs use ("src");
for Object_Dir use "obj";
for Main use ("Analysis.py");
for Languages use ("Python");
for Source_Files use ("Analysis.py");
end Testpy;

and as I tried to compile `Analysis.py` I got the messages
> gprbuild -ws -c -f -u -PP:\Gnat\testpy.gpr Analysis.py
> testpy.gpr:7:26: language unknown for "analysis.py"
> gprbuild: "P:\Gnat\testpy.gpr" processing failed
> [2022-11-10 16:23:10] process exited with status 4, elapsed time: 03.78s

So, obviously I am missing something (and yeah, I took the last 2h searching the docs...), so, please, how would I fix that?

Thanks
Rego.

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<tkjs57$1abq$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=8999&group=comp.lang.ada#8999

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pMM5B9Rl/1LQCd+Nt14ETA.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
Date: Thu, 10 Nov 2022 22:57:59 +0100
Organization: Aioe.org NNTP Server
Message-ID: <tkjs57$1abq$1@gioia.aioe.org>
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="43386"; 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
 by: Dmitry A. Kazakov - Thu, 10 Nov 2022 21:57 UTC

On 2022-11-10 20:25, Rego, P. wrote:

> I'm trying to compile some Python files from an Ada project (in an integration which will consist of Ada, Python and Rust).

Python is not a compiled language.

1. If you want to create a Python module in a form of a dynamically
linked library, you must use C or Ada for that.

2. If you rather meant pre-compiled binary code (*.pyc). Python creates
them by py_compile command. See

https://docs.python.org/3/library/py_compile.html#py_compile.compile

There is also command-line interface:

https://docs.python.org/3/library/compileall.html

You possibly could configure gpr to call compileall on *.py files,
though it would make no sense to me.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9003&group=comp.lang.ada#9003

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:4d9a:0:b0:39c:d479:b1d9 with SMTP id a26-20020ac84d9a000000b0039cd479b1d9mr613299qtw.612.1668162358052;
Fri, 11 Nov 2022 02:25:58 -0800 (PST)
X-Received: by 2002:a05:6214:4002:b0:4bb:f798:fbc5 with SMTP id
kd2-20020a056214400200b004bbf798fbc5mr1369163qvb.0.1668162357828; Fri, 11 Nov
2022 02:25:57 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 11 Nov 2022 02:25:57 -0800 (PST)
In-Reply-To: <tkjs57$1abq$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=152.249.156.27; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu
NNTP-Posting-Host: 152.249.156.27
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com> <tkjs57$1abq$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
From: pvrego@gmail.com (Rego, P.)
Injection-Date: Fri, 11 Nov 2022 10:25:58 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2498
 by: Rego, P. - Fri, 11 Nov 2022 10:25 UTC

Hi Dmitry,

> Python is not a compiled language.
Indeed. It will not generate an object like any compiled language.
But Since Python is included in Languages list from Project properties, I expected
that the IDE were capable of statically checking the syntax and pointed the
"compilation" errors. Also, I expected that we could run the script from GPS, and
be able to debug it.
> 1. If you want to create a Python module in a form of a dynamically
> linked library, you must use C or Ada for that.

Not the case, I also don't see advantages of it (so I agree, I'd go directly to Ada or C).

> 2. If you rather meant pre-compiled binary code (*.pyc). Python creates
> them by py_compile command. See
> https://docs.python.org/3/library/py_compile.html#py_compile.compile
> There is also command-line interface:
> https://docs.python.org/3/library/compileall.html
> You possibly could configure gpr to call compileall on *.py files,
> though it would make no sense to me.

I think this would be the closer of what I was trying to do.
The idea is to help in the development. Instead of having to develop the
Python part from a separate IDE, being able to code in the same would
speed up things.

Would you have some example of it? (how to configure gpr to call
compileall on *.py files).

Thanks!

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<tkla8a$aqi$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9004&group=comp.lang.ada#9004

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pMM5B9Rl/1LQCd+Nt14ETA.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
Date: Fri, 11 Nov 2022 12:04:43 +0100
Organization: Aioe.org NNTP Server
Message-ID: <tkla8a$aqi$1@gioia.aioe.org>
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org>
<673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="11090"; 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
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Fri, 11 Nov 2022 11:04 UTC

On 2022-11-11 11:25, Rego, P. wrote:

>> 1. If you want to create a Python module in a form of a dynamically
>> linked library, you must use C or Ada for that.
>
> Not the case, I also don't see advantages of it (so I agree, I'd go directly to Ada or C).

Actually this is the way of doing scripting from Ada, like GPS IDE does.
You write a module, e.g. in Ada, and then you can import it in your
Python script. The module must be a DLL.

>> 2. If you rather meant pre-compiled binary code (*.pyc). Python creates
>> them by py_compile command. See
>> https://docs.python.org/3/library/py_compile.html#py_compile.compile
>> There is also command-line interface:
>> https://docs.python.org/3/library/compileall.html
>> You possibly could configure gpr to call compileall on *.py files,
>> though it would make no sense to me.
>
> I think this would be the closer of what I was trying to do.
> The idea is to help in the development. Instead of having to develop the
> Python part from a separate IDE, being able to code in the same would
> speed up things.
>
> Would you have some example of it? (how to configure gpr to call
> compileall on *.py files).

You could start with something like this:

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", "compileall");
end Compiler;
package Naming is
for Body_Suffix ("Python") use ".py";
end Naming;
end Python;

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9005&group=comp.lang.ada#9005

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:5445:b0:4bb:d324:3b0 with SMTP id kz5-20020a056214544500b004bbd32403b0mr1477222qvb.14.1668166129663;
Fri, 11 Nov 2022 03:28:49 -0800 (PST)
X-Received: by 2002:a05:6214:5b89:b0:4bb:6b72:3c36 with SMTP id
lq9-20020a0562145b8900b004bb6b723c36mr1383188qvb.121.1668166129489; Fri, 11
Nov 2022 03:28:49 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 11 Nov 2022 03:28:49 -0800 (PST)
In-Reply-To: <tkla8a$aqi$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=152.249.156.27; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu
NNTP-Posting-Host: 152.249.156.27
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org> <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
From: pvrego@gmail.com (Rego, P.)
Injection-Date: Fri, 11 Nov 2022 11:28:49 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2297
 by: Rego, P. - Fri, 11 Nov 2022 11:28 UTC

> You could start with something like this:

Thanks Dmitry!

> 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", "compileall");
> end Compiler;
> package Naming is
> for Body_Suffix ("Python") use ".py";
> end Naming;
> end Python;

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.

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<tklipe$bk9$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9006&group=comp.lang.ada#9006

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pMM5B9Rl/1LQCd+Nt14ETA.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
Date: Fri, 11 Nov 2022 14:30:22 +0100
Organization: Aioe.org NNTP Server
Message-ID: <tklipe$bk9$1@gioia.aioe.org>
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org>
<673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org>
<dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="11913"; 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
 by: Dmitry A. Kazakov - Fri, 11 Nov 2022 13:30 UTC

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... (:-))

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<tkljbu$kfs$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9007&group=comp.lang.ada#9007

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pMM5B9Rl/1LQCd+Nt14ETA.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (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: <tkljbu$kfs$1@gioia.aioe.org>
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org>
<673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org>
<dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
<tklipe$bk9$1@gioia.aioe.org>
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
 by: Dmitry A. Kazakov - Fri, 11 Nov 2022 13:40 UTC

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

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<e1812a6d-18a7-4cd6-b098-82e440718a19n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9008&group=comp.lang.ada#9008

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:ca0a:0:b0:4b9:ef84:afc3 with SMTP id c10-20020a0cca0a000000b004b9ef84afc3mr2259637qvk.57.1668180051347;
Fri, 11 Nov 2022 07:20:51 -0800 (PST)
X-Received: by 2002:ac8:1384:0:b0:3a5:591e:a60a with SMTP id
h4-20020ac81384000000b003a5591ea60amr1725655qtj.309.1668180051169; Fri, 11
Nov 2022 07:20:51 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 11 Nov 2022 07:20:50 -0800 (PST)
In-Reply-To: <dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=46.15.69.199; posting-account=uulyKwoAAAA86DO0ODu--rZtbje8Sytn
NNTP-Posting-Host: 46.15.69.199
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org> <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org> <dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e1812a6d-18a7-4cd6-b098-82e440718a19n@googlegroups.com>
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
From: ehh.public@gmail.com (Egil H H)
Injection-Date: Fri, 11 Nov 2022 15:20:51 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2665
 by: Egil H H - Fri, 11 Nov 2022 15:20 UTC

On Friday, November 11, 2022 at 12:28:50 PM UTC+1, Rego, P. wrote:
> > You could start with something like this:
> Thanks Dmitry!
> > 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", "compileall");
> > end Compiler;
> > package Naming is
> > for Body_Suffix ("Python") use ".py";
> > end Naming;
> > end Python;
> 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.

There are a couple of project level attributes you can play around with:
for Object_Generated("Python") use "False";

and

for Objects_Linked("Python") use "False";

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<fb9e0383-9daa-453d-9968-a19ade60dc5fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9009&group=comp.lang.ada#9009

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:418d:b0:4c6:10ee:b758 with SMTP id ld13-20020a056214418d00b004c610eeb758mr2872466qvb.130.1668190093551;
Fri, 11 Nov 2022 10:08:13 -0800 (PST)
X-Received: by 2002:a05:620a:3dc:b0:6fa:17e5:b62b with SMTP id
r28-20020a05620a03dc00b006fa17e5b62bmr2078667qkm.676.1668190093314; Fri, 11
Nov 2022 10:08:13 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 11 Nov 2022 10:08:13 -0800 (PST)
In-Reply-To: <tklipe$bk9$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=152.249.156.27; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu
NNTP-Posting-Host: 152.249.156.27
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org> <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org> <dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
<tklipe$bk9$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fb9e0383-9daa-453d-9968-a19ade60dc5fn@googlegroups.com>
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
From: pvrego@gmail.com (Rego, P.)
Injection-Date: Fri, 11 Nov 2022 18:08:13 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1917
 by: Rego, P. - Fri, 11 Nov 2022 18:08 UTC

> It should show syntax errors. If you remove -m py_compile switches, then
> it will "compile" and execute.

Got some error when removed -m switch
C:\GNAT\2021\libexec\gnatstudio\gnathub\share\gnathub\python\python.exe: can't open file 'compileall': [Errno 2] No such file or directory

> (Python is not the thing you would wish to use in an IDE or anywhere,
> pretty much consistently so... (:-))

LOL. I got lazy :-) IDEs make life easier, debugging, autocomplete, syntax highlight,
pretty printing, analysers rsrsrs
even for Py stuff (can't run away from it)

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<bad9f4e0-09c2-47e4-a71e-05d828bcfb82n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9010&group=comp.lang.ada#9010

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:ab83:0:b0:4c6:dd9:586c with SMTP id j3-20020a0cab83000000b004c60dd9586cmr2898771qvb.40.1668190353241;
Fri, 11 Nov 2022 10:12:33 -0800 (PST)
X-Received: by 2002:ac8:6690:0:b0:3a5:933:e8a9 with SMTP id
d16-20020ac86690000000b003a50933e8a9mr2398428qtp.676.1668190353058; Fri, 11
Nov 2022 10:12:33 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 11 Nov 2022 10:12:32 -0800 (PST)
In-Reply-To: <tkljbu$kfs$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=152.249.156.27; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu
NNTP-Posting-Host: 152.249.156.27
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org> <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org> <dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
<tklipe$bk9$1@gioia.aioe.org> <tkljbu$kfs$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bad9f4e0-09c2-47e4-a71e-05d828bcfb82n@googlegroups.com>
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
From: pvrego@gmail.com (Rego, P.)
Injection-Date: Fri, 11 Nov 2022 18:12:33 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2404
 by: Rego, P. - Fri, 11 Nov 2022 18:12 UTC

> Note that Linker does not take language e.g. ("Python") you just write:
> package Linker is
> for Driver use "pyinstaller.exe";

did that... got some more ugly messages

gprbuild -d -PP:\Gnat\testpy.gpr P:\Gnat\src\Analysis.py
Compile
[python] analysis.py
gprbuild: raised ADA.ASSERTIONS.ASSERTION_ERROR : Invalid Id 0
[C:\GNAT\2021\bin\gprbuild.exe]
0x8db0d6
0x648431
0x648671
0x4832bc
0x492553
0x49260e
0x4932d4
0x413bd5
0x948929
0x401423
0x40113b
[C:\WINDOWS\System32\KERNEL32.DLL]
0x7ffc052b7032
[C:\WINDOWS\SYSTEM32\ntdll.dll]
0x7ffc05e6269f
[2022-11-11 15:10:07] process exited with status 4, elapsed time: 04.03s

and now I oversimplified the Analysis.py to
import os
import sys
print('test')

maybe I'm pushing harder than should (trying to compile/run/whatever Python from GPS),
but still curious.
> 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... (:-))

Who knows :p

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<56f24d16-2d4c-4bbd-b44c-49e140ed73a0n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9011&group=comp.lang.ada#9011

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:ac06:0:b0:6ee:3a2e:9fb1 with SMTP id e6-20020a37ac06000000b006ee3a2e9fb1mr2074021qkm.139.1668190484146;
Fri, 11 Nov 2022 10:14:44 -0800 (PST)
X-Received: by 2002:a37:8d46:0:b0:6fa:b41e:7e3d with SMTP id
p67-20020a378d46000000b006fab41e7e3dmr2119061qkd.452.1668190483934; Fri, 11
Nov 2022 10:14:43 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 11 Nov 2022 10:14:43 -0800 (PST)
In-Reply-To: <e1812a6d-18a7-4cd6-b098-82e440718a19n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=152.249.156.27; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu
NNTP-Posting-Host: 152.249.156.27
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org> <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org> <dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
<e1812a6d-18a7-4cd6-b098-82e440718a19n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <56f24d16-2d4c-4bbd-b44c-49e140ed73a0n@googlegroups.com>
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
From: pvrego@gmail.com (Rego, P.)
Injection-Date: Fri, 11 Nov 2022 18:14:44 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1720
 by: Rego, P. - Fri, 11 Nov 2022 18:14 UTC

> There are a couple of project level attributes you can play around with:
> for Object_Generated("Python") use "False";
> and
> for Objects_Linked("Python") use "False";

I had tried those before, removed because it didn't change anything (or it seemed)
Now after including Linker package I put them back, still no effect.

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<tkm91g$t7f$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9012&group=comp.lang.ada#9012

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pMM5B9Rl/1LQCd+Nt14ETA.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
Date: Fri, 11 Nov 2022 20:50:10 +0100
Organization: Aioe.org NNTP Server
Message-ID: <tkm91g$t7f$1@gioia.aioe.org>
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org>
<673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org>
<dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
<tklipe$bk9$1@gioia.aioe.org>
<fb9e0383-9daa-453d-9968-a19ade60dc5fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="29935"; 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
 by: Dmitry A. Kazakov - Fri, 11 Nov 2022 19:50 UTC

On 2022-11-11 19:08, Rego, P. wrote:
>> It should show syntax errors. If you remove -m py_compile switches, then
>> it will "compile" and execute.
>
> Got some error when removed -m switch
> C:\GNAT\2021\libexec\gnatstudio\gnathub\share\gnathub\python\python.exe: can't open file 'compileall': [Errno 2] No such file or directory

Because it is one of these three:

1. for Required_Switches ("Python") use ("-m", "py_compile");
2. for Required_Switches ("Python") use ("-m", "compileall");
3. nothing

#1 results in

python.exe -m py_compile <file>

= compile only. py_compile is the module name that takes <file> as an
argument.

#2 results in

python.exe -m compileall <file>

= compile, generate *.pyc files, store them at the Python library
location. compileall is the module name.

#3 results in

python.exe <file>

= compile/run <file>.

When you remove -m but leave compileall you get

python.exe compileall <file>

and compileall is treated as a file.

Command line-arguments are here:

https://docs.python.org/3/using/cmdline.html

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<733d5983-7ece-4f64-aff6-6b23f5ed0e2cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9013&group=comp.lang.ada#9013

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:e48e:0:b0:4c6:141f:819c with SMTP id n14-20020a0ce48e000000b004c6141f819cmr3420168qvl.76.1668197112846;
Fri, 11 Nov 2022 12:05:12 -0800 (PST)
X-Received: by 2002:a05:620a:16d0:b0:6ec:ff06:8307 with SMTP id
a16-20020a05620a16d000b006ecff068307mr2407898qkn.683.1668197112663; Fri, 11
Nov 2022 12:05:12 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 11 Nov 2022 12:05:12 -0800 (PST)
In-Reply-To: <56f24d16-2d4c-4bbd-b44c-49e140ed73a0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=81.167.0.45; posting-account=uulyKwoAAAA86DO0ODu--rZtbje8Sytn
NNTP-Posting-Host: 81.167.0.45
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org> <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org> <dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
<e1812a6d-18a7-4cd6-b098-82e440718a19n@googlegroups.com> <56f24d16-2d4c-4bbd-b44c-49e140ed73a0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <733d5983-7ece-4f64-aff6-6b23f5ed0e2cn@googlegroups.com>
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
From: ehh.public@gmail.com (Egil H H)
Injection-Date: Fri, 11 Nov 2022 20:05:12 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1898
 by: Egil H H - Fri, 11 Nov 2022 20:05 UTC

On Friday, November 11, 2022 at 7:14:45 PM UTC+1, Rego, P. wrote:
> > There are a couple of project level attributes you can play around with:
> > for Object_Generated("Python") use "False";
> > and
> > for Objects_Linked("Python") use "False";
> I had tried those before, removed because it didn't change anything (or it seemed)
> Now after including Linker package I put them back, still no effect.

Project level, not in the Linker package

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<aa7d52fa-34b6-4b8c-b813-3bd77d666054n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9014&group=comp.lang.ada#9014

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:2d85:0:b0:6fa:22fd:94ca with SMTP id t127-20020a372d85000000b006fa22fd94camr2854324qkh.338.1668201899598;
Fri, 11 Nov 2022 13:24:59 -0800 (PST)
X-Received: by 2002:a37:aa53:0:b0:6fa:4b0b:d08f with SMTP id
t80-20020a37aa53000000b006fa4b0bd08fmr2825740qke.488.1668201899400; Fri, 11
Nov 2022 13:24:59 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 11 Nov 2022 13:24:59 -0800 (PST)
In-Reply-To: <733d5983-7ece-4f64-aff6-6b23f5ed0e2cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=152.249.156.27; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu
NNTP-Posting-Host: 152.249.156.27
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org> <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org> <dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
<e1812a6d-18a7-4cd6-b098-82e440718a19n@googlegroups.com> <56f24d16-2d4c-4bbd-b44c-49e140ed73a0n@googlegroups.com>
<733d5983-7ece-4f64-aff6-6b23f5ed0e2cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <aa7d52fa-34b6-4b8c-b813-3bd77d666054n@googlegroups.com>
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
From: pvrego@gmail.com (Rego, P.)
Injection-Date: Fri, 11 Nov 2022 21:24:59 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1564
 by: Rego, P. - Fri, 11 Nov 2022 21:24 UTC

> Project level, not in the Linker package
Yep, as I did.

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<6432f1f4-b641-4e21-9953-75b36f87c8e6n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9015&group=comp.lang.ada#9015

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:418d:b0:4c6:10ee:b758 with SMTP id ld13-20020a056214418d00b004c610eeb758mr3622100qvb.130.1668202441982;
Fri, 11 Nov 2022 13:34:01 -0800 (PST)
X-Received: by 2002:ae9:f70a:0:b0:6ee:830c:488a with SMTP id
s10-20020ae9f70a000000b006ee830c488amr2750353qkg.596.1668202441767; Fri, 11
Nov 2022 13:34:01 -0800 (PST)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 11 Nov 2022 13:34:01 -0800 (PST)
In-Reply-To: <tkm91g$t7f$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=152.249.156.27; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu
NNTP-Posting-Host: 152.249.156.27
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
<tkjs57$1abq$1@gioia.aioe.org> <673c0ad1-dd6d-4cc6-a191-3bcff7f1c5ddn@googlegroups.com>
<tkla8a$aqi$1@gioia.aioe.org> <dcb10b32-6d6b-493e-b4e7-15059e6473bdn@googlegroups.com>
<tklipe$bk9$1@gioia.aioe.org> <fb9e0383-9daa-453d-9968-a19ade60dc5fn@googlegroups.com>
<tkm91g$t7f$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6432f1f4-b641-4e21-9953-75b36f87c8e6n@googlegroups.com>
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
From: pvrego@gmail.com (Rego, P.)
Injection-Date: Fri, 11 Nov 2022 21:34:01 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Rego, P. - Fri, 11 Nov 2022 21:34 UTC

> 1. for Required_Switches ("Python") use ("-m", "py_compile");
> 2. for Required_Switches ("Python") use ("-m", "compileall");
> 3. nothing

Tried all the options, varing w/wo "-m". Not much exciting.

Current version is
--
project Testpy is
for Source_Dirs use ("src");
for Object_Dir use "obj";
for Languages use ("python");
for Objects_Linked ("python") use "False";
for Object_Generated ("python") use "False";

for Source_Files use ("Analysis.py");
for Main use ("Analysis.py");

package Naming is
for Body_Suffix ("python") use ".py";
end Naming;

package Compiler is
for Driver ("python") use "C:\GNAT\2021\libexec\gnatstudio\gnathub\share\gnathub\python\python.exe";
-- for Required_Switches ("python") use ("-m", "compileall");
-- for Required_Switches ("Python") use ("-m", "py_compile");
for Required_Switches ("Python") use ("-m","py_compile");
end Compiler;

package Linker is
for Driver use "C:\GNAT\2021\libexec\gnatstudio\gnathub\share\gnathub\python\python.exe";
end Linker;

for Object_Generated("Python") use "False";
for Objects_Linked("Python") use "False";

end Testpy;
--

Curiosily, compiling Analysis.py with
# Analysis.py
import os
import sys

print('test')
blabla

(so obviously it should not compile), returns no error

gprbuild -ws -c -f -u -PP:\Gnat\testpy.gpr Analysis.py
Compile
[python] analysis.py
[2022-11-11 18:27:03] process terminated successfully, elapsed time: 03.58s

But no problem. I'm convinced that Python (as external code, not GPS internal
script) should be kept very far from GPS.

Thanks!

Re: Running Python code from GPRBuild (Calling from GNAT Studio)

<867d009ilm.fsf@stephe-leake.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=9017&group=comp.lang.ada#9017

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!gy7opw3oYmwPg+L8gXeD2w.user.46.165.242.75.POSTED!not-for-mail
From: stephen_leake@stephe-leake.org (Stephen Leake)
Newsgroups: comp.lang.ada
Subject: Re: Running Python code from GPRBuild (Calling from GNAT Studio)
Date: Sat, 12 Nov 2022 09:40:37 -0800
Organization: Aioe.org NNTP Server
Message-ID: <867d009ilm.fsf@stephe-leake.org>
References: <7d578e15-d21e-4eae-a519-d98c1bf1145cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="14014"; posting-host="gy7opw3oYmwPg+L8gXeD2w.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:Y7BP2JtNaaMLMy0DlUwftNOSw4s=
 by: Stephen Leake - Sat, 12 Nov 2022 17:40 UTC

"Rego, P." <pvrego@gmail.com> writes:

> Hello everyone, long time no see some of you, I hope everyone is fine.
>
> I'm trying to compile some Python files from an Ada project (in an
> integration which will consist of Ada, Python and Rust). But let's
> simplify the things, so I created a Python-only project using this :
>
> -- testpy.gpr
> project Testpy is
> for Source_Dirs use ("src");
> for Object_Dir use "obj";
> for Main use ("Analysis.py");
> for Languages use ("Python");
> for Source_Files use ("Analysis.py");
> end Testpy;
>
> and as I tried to compile `Analysis.py` I got the messages
>> gprbuild -ws -c -f -u -PP:\Gnat\testpy.gpr Analysis.py
>> testpy.gpr:7:26: language unknown for "analysis.py"

So it does not associate ".py" with "Python". Try setting Spec_Suffix,
Body_Suffix in package Naming.

--
-- Stephe


devel / comp.lang.ada / Re: Running Python code from GPRBuild (Calling from GNAT Studio)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor