[gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

Alon Bar-Lev-3
Hi,

When building using python2.7 gpg/gpgme.py is generated ok.

When building using python3.4 it is corrupted, examples:
---
def gpgme_err_make(source: 'gpgme_err_source_t', code:
'gpgme_err_code_t') -> "gpgme_error_t":
    """gpgme_err_make(source, code) -> gpgme_error_t"""
    return _gpgme.gpgme_err_make(source, code)

def gpgme_error(code: 'gpgme_err_code_t') -> "gpgme_error_t":
    """gpgme_error(code) -> gpgme_error_t"""
    return _gpgme.gpgme_error(code)

def gpgme_err_code(err: 'gpgme_error_t') -> "gpgme_err_code_t":
    """gpgme_err_code(err) -> gpgme_err_code_t"""
    return _gpgme.gpgme_err_code(err)
---

Please advise.

Thanks,
Alon

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

Justus Winter
Alon Bar-Lev <[hidden email]> writes:

> Hi,
>
> When building using python2.7 gpg/gpgme.py is generated ok.
>
> When building using python3.4 it is corrupted, examples:
> ---
> def gpgme_err_make(source: 'gpgme_err_source_t', code:
> 'gpgme_err_code_t') -> "gpgme_error_t":
>     """gpgme_err_make(source, code) -> gpgme_error_t"""
>     return _gpgme.gpgme_err_make(source, code)
>
> def gpgme_error(code: 'gpgme_err_code_t') -> "gpgme_error_t":
>     """gpgme_error(code) -> gpgme_error_t"""
>     return _gpgme.gpgme_error(code)
>
> def gpgme_err_code(err: 'gpgme_error_t') -> "gpgme_err_code_t":
>     """gpgme_err_code(err) -> gpgme_err_code_t"""
>     return _gpgme.gpgme_err_code(err)
> ---
>
> Please advise.
What makes you say the code is corrupted?  I assume that your MUA
introduced linebreaks, but otherwise this looks ok.

Justus

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

Alon Bar-Lev-3
On 29 March 2017 at 12:36, Justus Winter <[hidden email]> wrote:

> Alon Bar-Lev <[hidden email]> writes:
>
>> Hi,
>>
>> When building using python2.7 gpg/gpgme.py is generated ok.
>>
>> When building using python3.4 it is corrupted, examples:
>> ---
>> def gpgme_err_make(source: 'gpgme_err_source_t', code:
>> 'gpgme_err_code_t') -> "gpgme_error_t":
>>     """gpgme_err_make(source, code) -> gpgme_error_t"""
>>     return _gpgme.gpgme_err_make(source, code)
>>
>> def gpgme_error(code: 'gpgme_err_code_t') -> "gpgme_error_t":
>>     """gpgme_error(code) -> gpgme_error_t"""
>>     return _gpgme.gpgme_error(code)
>>
>> def gpgme_err_code(err: 'gpgme_error_t') -> "gpgme_err_code_t":
>>     """gpgme_err_code(err) -> gpgme_err_code_t"""
>>     return _gpgme.gpgme_err_code(err)
>> ---
>>
>> Please advise.
>
> What makes you say the code is corrupted?  I assume that your MUA
> introduced linebreaks, but otherwise this looks ok.
>

I do not think:
"""
def gpgme_err_code(err: 'gpgme_error_t') -> "gpgme_err_code_t"
"""
Is valid python, also python does not think so... :)

Alon

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

Peter Lebbing
In reply to this post by Justus Winter
On 29/03/17 11:36, Justus Winter wrote:
> What makes you say the code is corrupted?  I assume that your MUA
> introduced linebreaks, but otherwise this looks ok.

Hah! :-) To me, it looks like the layout is about the only thing that is
actually proper Python :-). "def" is on a single line, then comes a properly
indented docstring, then a return statement on one line. Maybe your MUA
introduced linebreaks?

Cheers,

Peter.

--
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <http://digitalbrains.com/2012/openpgp-key-peter>


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

Alon Bar-Lev-3
On 29 March 2017 at 13:25, Peter Lebbing <[hidden email]> wrote:
> On 29/03/17 11:36, Justus Winter wrote:
>> What makes you say the code is corrupted?  I assume that your MUA
>> introduced linebreaks, but otherwise this looks ok.
>
> Hah! :-) To me, it looks like the layout is about the only thing that is
> actually proper Python :-). "def" is on a single line, then comes a properly
> indented docstring, then a return statement on one line. Maybe your MUA
> introduced linebreaks?

No, something is wrong with the automatic processing of the docstrings
and generation of the file.
As I wrote, in python-2.7 it works properly.
I can send a complete file if it will help.

# here it is bad, notice at parameter source: 'xxx' which is invalid
# also notice at the -> "gpgme_error_t" which is invalid.
def gpgme_err_make(source: 'gpgme_err_source_t', code:
'gpgme_err_code_t') -> "gpgme_error_t":

# this is the docstring which is valid... but leftovers are not
removed from the above during generation
    """gpgme_err_make(source, code) -> gpgme_error_t"""
    return _gpgme.gpgme_err_make(source, code)

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

Justus Winter
In reply to this post by Alon Bar-Lev-3
Alon Bar-Lev <[hidden email]> writes:

> On 29 March 2017 at 12:36, Justus Winter <[hidden email]> wrote:
>> Alon Bar-Lev <[hidden email]> writes:
>>
>>> Hi,
>>>
>>> When building using python2.7 gpg/gpgme.py is generated ok.
>>>
>>> When building using python3.4 it is corrupted, examples:
>>> ---
>>> def gpgme_err_make(source: 'gpgme_err_source_t', code:
>>> 'gpgme_err_code_t') -> "gpgme_error_t":
>>>     """gpgme_err_make(source, code) -> gpgme_error_t"""
>>>     return _gpgme.gpgme_err_make(source, code)
>>>
>>> def gpgme_error(code: 'gpgme_err_code_t') -> "gpgme_error_t":
>>>     """gpgme_error(code) -> gpgme_error_t"""
>>>     return _gpgme.gpgme_error(code)
>>>
>>> def gpgme_err_code(err: 'gpgme_error_t') -> "gpgme_err_code_t":
>>>     """gpgme_err_code(err) -> gpgme_err_code_t"""
>>>     return _gpgme.gpgme_err_code(err)
>>> ---
>>>
>>> Please advise.
>>
>> What makes you say the code is corrupted?  I assume that your MUA
>> introduced linebreaks, but otherwise this looks ok.
>>
>
> I do not think:
> """
> def gpgme_err_code(err: 'gpgme_error_t') -> "gpgme_err_code_t"
> """
> Is valid python, also python does not think so... :)
Yes it is.  This is a type hint.

https://www.python.org/dev/peps/pep-0484/

The pep suggests it is fully implemented in Python3.5, but the
documentation for Python3.4 suggests that this particular annotation is
supported too:

https://docs.python.org/3.4/reference/compound_stmts.html#function-definitions

Are you actually having a problem or did it just look weird to you?


Justus

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (497 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

Peter Lebbing
In reply to this post by Alon Bar-Lev-3
On 29/03/17 12:30, Alon Bar-Lev wrote:
> No, something is wrong with the automatic processing of the docstrings
> and generation of the file.

Yes, I agree, I just thought it was funny that Justus said that it was proper
except for the layout, whereas it seemed to me that those function definition
lines were whacked as you say, but the layout checked out just fine. I think
this was ironic, but this is a risky statement because some people are really
picky about their iron.

> # here it is bad, notice at parameter source: 'xxx' which is invalid
> # also notice at the -> "gpgme_error_t" which is invalid.
> def gpgme_err_make(source: 'gpgme_err_source_t', code:
> 'gpgme_err_code_t') -> "gpgme_error_t":

And upon checking, this line was also in your first mail and has an invalid
linebreak, so the irony turned out to be less solid. But still, there was a
wrong linebreak, singular, not plural :-).

Sorry that my joke actually cost you time.

Peter.

--
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <http://digitalbrains.com/2012/openpgp-key-peter>


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

Alon Bar-Lev-3
In reply to this post by Justus Winter
On 29 March 2017 at 13:33, Justus Winter <[hidden email]> wrote:

>
> Yes it is.  This is a type hint.
>
> https://www.python.org/dev/peps/pep-0484/
>
> The pep suggests it is fully implemented in Python3.5, but the
> documentation for Python3.4 suggests that this particular annotation is
> supported too:
>
> https://docs.python.org/3.4/reference/compound_stmts.html#function-definitions
>
> Are you actually having a problem or did it just look weird to you?

OK, I was not aware that python2, python3 should generate a different
code, so I hit a problem with detection of correct version and trying
to compile using python2 what python3 generate. I will hack this
somehow, but root cause is the fact that these files are written into
sources directory while they are actually build artifacts. This
relates to our other thread.

Thanks for the help!

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [gpgme] python3.4 codegen of gpg/gpgme.py is corrupted

Justus Winter
Alon Bar-Lev <[hidden email]> writes:

> OK, I was not aware that python2, python3 should generate a different
> code,

Previously it did not.

> so I hit a problem with detection of correct version and trying
> to compile using python2 what python3 generate. I will hack this
> somehow, but root cause is the fact that these files are written into
> sources directory while they are actually build artifacts. This
> relates to our other thread.

Yes, I had to fix that fe65a26ab584bd70fad45c7c4d44330e30a748a4 before I
could merge d184dbbba8987d9f387feb25791ed891e108dabc.  I don't know why
you are having that problem.

Justus

_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

signature.asc (497 bytes) Download Attachment
Loading...