Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Presidency: The greased pig in the field game of American politics. -- Ambrose Bierce


devel / comp.lang.python / Re: [pygettext] --package-name and --package-version unknown

SubjectAuthor
* [pygettext] --package-name and --package-version unknownc.buhtz
`* Re: [pygettext] --package-name and --package-version unknownaapost
 `* Re: [pygettext] --package-name and --package-version unknownc.buhtz
  +- Re: [pygettext] --package-name and --package-version unknownaapost
  `- Re: [pygettext] --package-name and --package-version unknownaapost

1
[pygettext] --package-name and --package-version unknown

<mailman.31.1683240384.13552.python-list@python.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: c.buhtz@posteo.jp
Newsgroups: comp.lang.python
Subject: [pygettext] --package-name and --package-version unknown
Date: Thu, 04 May 2023 21:38:26 +0000
Lines: 16
Message-ID: <mailman.31.1683240384.13552.python-list@python.org>
References: <27f92c2565e5256cc1263aa9a996550a@posteo.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de gv08B7pFzHLgUBEwtO6EMQITiJCbk45qtNY7x5O6qiug==
Return-Path: <c.buhtz@posteo.jp>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=posteo.jp header.i=@posteo.jp header.b=eyroBsqY;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.050
X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'subject:name': 0.07;
'subject:version': 0.09; 'arguments': 0.16; 'python3': 0.16;
'subject:package': 0.16; 'subject:unknown': 0.16; 'to:addr:python-
list': 0.20; 'header': 0.23; 'received:de': 0.23; 'modify': 0.31;
'official': 0.32; 'assume': 0.32; 'christian': 0.32; 'unknown':
0.32; 'but': 0.32; "i'm": 0.33; 'able': 0.34; 'skip:" 20': 0.34;
'subject:[': 0.37; 'this.': 0.37; 'handle': 0.39; 'use': 0.39;
'files.': 0.40; 'hello,': 0.40; 'right': 0.68; 'received:185':
0.71; 'pot': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.jp; s=2017;
t=1683236306; bh=qdqO1dfvRNuTlsAvUVH29ifZncXgGeEH+p1bjoU00BI=;
h=Date:From:To:Subject:From;
b=eyroBsqYyic7WnIRgNhSMBocuzC34fO9TPHDYY3dpn8AO15umZvjN0zve43Ui0X59
BXunZf7gDU0JHXojnSM7RaNcX+poo90SjT08jGnQESR/xYfhSloLYkaN/eNzuhayWq
rii2JN1OaD9IE71vod/N46VdYuVH7brAoevAzP2L6ZhQGgX8H/8KGJaUKDKF7nqhZS
C07xMOCP7HRLnNw8Z56PKU4C5cl9iaGIzMJyFui2FKG6DFkOt9NuvdmI6hAF5v32ah
/hj5Nxv44HpIrH4hu1d0hGhgb1hm8H5Ea25oKkAGXvjV/UyCVwWtqi4FSCGe7SyFKl
mjpCODNrHQj4g==
X-Mailman-Approved-At: Thu, 04 May 2023 18:46:23 -0400
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <27f92c2565e5256cc1263aa9a996550a@posteo.de>
 by: c.buhtz@posteo.jp - Thu, 4 May 2023 21:38 UTC

Hello,

am I right to assume that "pygettext" is part of the official Python3
"package"? So it is OK to aks here?

I do use pygettext to handle po and pot files. In the manpage I'm not
able to find help about this.
I would like to modify the header that pygettext does create in each
po-file.

How can I set the "Project-Id-Version"? With "xgettext" I would use the
arguments "--package-name" and "--package-version" for this but they are
unknown for "pygettext".

Kind
Christian

Re: [pygettext] --package-name and --package-version unknown

<u31ls1$2oc5$1@nnrp.usenet.blueworldhosting.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED!not-for-mail
From: aapost@idontexist.club (aapost)
Newsgroups: comp.lang.python
Subject: Re: [pygettext] --package-name and --package-version unknown
Date: Thu, 4 May 2023 21:24:17 -0400
Organization: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com)
Message-ID: <u31ls1$2oc5$1@nnrp.usenet.blueworldhosting.com>
References: <27f92c2565e5256cc1263aa9a996550a@posteo.de>
<mailman.31.1683240384.13552.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 5 May 2023 01:24:17 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com;
logging-data="90501"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.0
Cancel-Lock: sha1:CxBsTeC/5q3AY/PEJep4UN69XBw= sha256:ikjsKK2GfUBt9n+1p1UqhynAPyUoPW/8M+0N1wFLaYk=
sha1:OjnZCVAQJXPW+sOGwsuCpWFLRbY= sha256:V/GaNubabN0042xceHI2dv3OehTTBVqHZ9yLDSXeDDQ=
Content-Language: en-US
In-Reply-To: <mailman.31.1683240384.13552.python-list@python.org>
 by: aapost - Fri, 5 May 2023 01:24 UTC

On 5/4/23 17:38, c.buhtz@posteo.jp wrote:
> am I right to assume that "pygettext" is part of the official Python3
> "package"? So it is OK to aks here?
>
> How can I set the "Project-Id-Version"? With "xgettext" I would use the
> arguments "--package-name" and "--package-version" for this but they are
> unknown for "pygettext".

pygettext is deprecated since xgettext supports python now, so using
xgettext is recommended.

That being said, pygettext does not support the options, but it could be
modified pretty easily.
Untested but if you wanted to add that functionality in just create a
modified pygettext.py with something like:

link PACKAGE and VERSION to variables:

pot_header = _('''\
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# msgid ""
msgstr ""
"Project-Id-Version: %(packagename)s %(packageversion)s\\n"
"POT-Creation-Date: %(time)s\\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
"Language-Team: LANGUAGE <LL@li.org>\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=%(charset)s\\n"
"Content-Transfer-Encoding: %(encoding)s\\n"
"Generated-By: pygettext.py %(version)s\\n"
''')

add attributes to Options class:

class Options:
# constants
GNU = 1
SOLARIS = 2
# defaults
extractall = 0 # FIXME: currently this option has no effect at all.
escape = 0
keywords = []
outpath = ''
outfile = 'messages.pot'
writelocations = 1
locationstyle = GNU
verbose = 0
width = 78
excludefilename = ''
docstrings = 0
nodocstrings = {}
packagename = "PACKAGE"
packageversion = "VERSION"

modify option parsing for loop to look for new options:
for opt, arg in opts:

elif opt in ('--package-name',):
options.packagename = arg
elif opt in ('--package-version',):
options.packageversion = arg

grab those options when generating file output:

def write(self, fp):
options = self.__options
packagename = options.packagename
packageversion = options.packageversion
timestamp = time.strftime('%Y-%m-%d %H:%M%z')
encoding = fp.encoding if fp.encoding else 'UTF-8'
print(pot_header % {'packagename': packagename,
'packageversion': packageversion,
'time': timestamp, 'version': __version__,
'charset': encoding,
'encoding': '8bit'}, file=fp)

(did not test, so might be a bug or two)

Re: [pygettext] --package-name and --package-version unknown

<mailman.34.1683276003.13552.python-list@python.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: c.buhtz@posteo.jp
Newsgroups: comp.lang.python
Subject: Re: [pygettext] --package-name and --package-version unknown
Date: Fri, 05 May 2023 08:39:54 +0000
Lines: 9
Message-ID: <mailman.34.1683276003.13552.python-list@python.org>
References: <27f92c2565e5256cc1263aa9a996550a@posteo.de>
<mailman.31.1683240384.13552.python-list@python.org>
<u31ls1$2oc5$1@nnrp.usenet.blueworldhosting.com>
<4083df1963eba88c54c833c7c2f04e34@posteo.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 18R5gMY6J6IqmauKLTMeCAsHD41RCRM5UGJt627ssFlQ==
Return-Path: <c.buhtz@posteo.jp>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=posteo.jp header.i=@posteo.jp header.b=QJmfbP+U;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.016
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:name': 0.07;
'schrieb': 0.09; 'subject:version': 0.09; 'answer.': 0.16;
'docs.': 0.16; 'recommended.': 0.16; 'subject:package': 0.16;
'subject:unknown': 0.16; 'python': 0.16; 'to:addr:python-list':
0.20; 'subject:: [': 0.21; 'received:de': 0.23; 'official': 0.32;
'header:In-Reply-To:1': 0.34; 'using': 0.37; 'thanks': 0.38;
'mentioned': 0.39; 'still': 0.40; 'should': 0.40; 'tell': 0.60;
'now,': 0.67; 'received:185': 0.71
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.jp; s=2017;
t=1683275995; bh=YkhdMbMJ2pZAA5YaB+5ltK6rNujKhITBsSm4iXwssIo=;
h=Date:From:To:Subject:From;
b=QJmfbP+UmvRQBfiEPFI07StPbSCjMtMKgohjG8krlw15ooD7/bcqmmYJeyZyXgeqc
oK/iLx8z7sh2NKac4FX+INSOHpGzHbN1e83pgwcm5595sifGY2UOlO0+j/tw5bDh9e
d3lOz0xxVhxO2g2Y/qyZpvdZc6aY1T4Zh3nr3gWY+UO31EvoZlUXMT+brgehqNskPQ
gacATiYPJ4/iU3oCm24y9uEgwlhjKc/uYNijqC/J3VOLPeYx4CoZSpKcI1lSoK2yzu
mdipdV14DxI5qDQSpSiGh4DPKklBzKdirj9g+BKf/b2aBWTWQRDrcgpfgfxXGlSMrk
4qNjnPgZjaXwQ==
Mail-Followup-To: python-list@python.org
In-Reply-To: <u31ls1$2oc5$1@nnrp.usenet.blueworldhosting.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <4083df1963eba88c54c833c7c2f04e34@posteo.de>
X-Mailman-Original-References: <27f92c2565e5256cc1263aa9a996550a@posteo.de>
<mailman.31.1683240384.13552.python-list@python.org>
<u31ls1$2oc5$1@nnrp.usenet.blueworldhosting.com>
 by: c.buhtz@posteo.jp - Fri, 5 May 2023 08:39 UTC

Thanks for the answer.

Am 05.05.2023 03:24 schrieb aapost:
> pygettext is deprecated since xgettext supports python now, so using
> xgettext is recommended.

If this is the official case then it should be mentioned in the python
docs. The 3.11 docs still tell about pygettext and xgettext and don't
recommend one of it.

Re: [pygettext] --package-name and --package-version unknown

<u32gbm$glk$1@nnrp.usenet.blueworldhosting.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED!not-for-mail
From: aapost@idontexist.club (aapost)
Newsgroups: comp.lang.python
Subject: Re: [pygettext] --package-name and --package-version unknown
Date: Fri, 5 May 2023 04:56:22 -0400
Organization: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com)
Message-ID: <u32gbm$glk$1@nnrp.usenet.blueworldhosting.com>
References: <27f92c2565e5256cc1263aa9a996550a@posteo.de>
<mailman.31.1683240384.13552.python-list@python.org>
<u31ls1$2oc5$1@nnrp.usenet.blueworldhosting.com>
<4083df1963eba88c54c833c7c2f04e34@posteo.de>
<mailman.34.1683276003.13552.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 5 May 2023 08:56:22 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com;
logging-data="17076"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.0
Cancel-Lock: sha1:miGnklHCjZNQGCL+LkGBNajtsAg= sha256:vwkZNin41GYNdJoPWXXIHwA8AidowlIT8g5qZLVx7a4=
sha1:PZ17w8DH1uFcvPQMxS/9AIENUnc= sha256:6cCRS/AzKeLAREqm/O68fevwS5kfNVxlvXxYAS9fACs=
Content-Language: en-US
In-Reply-To: <mailman.34.1683276003.13552.python-list@python.org>
 by: aapost - Fri, 5 May 2023 08:56 UTC

On 5/5/23 04:39, c.buhtz@posteo.jp wrote:
> Thanks for the answer.
>
> Am 05.05.2023 03:24 schrieb aapost:
>> pygettext is deprecated since xgettext supports python now, so using
>> xgettext is recommended.
>
> If this is the official case then it should be mentioned in the python
> docs. The 3.11 docs still tell about pygettext and xgettext and don't
> recommend one of it.

Yep, no disagreement. A lot of things 'should' be though, and
technically it is (which docs being the key, lol):

$man pygettext

PYGETTEXT(1) General Commands
Manual PYGETTEXT(1)

NAME
pygettext - Python equivalent of xgettext(1)

SYNOPSIS
pygettext [OPTIONS] INPUTFILE ...

DESCRIPTION
pygettext is deprecated. The current version of xgettext
supports many languages, including Python.

pygettext uses Python's standard tokenize module to scan Python
source code, generating .pot files identical to what
GNU xgettext generates for C and C++ code. From there, the
standard GNU tools can be used.

pygettext searches only for _() by default, even though GNU
xgettext recognizes the following keywords: gettext,
dgettext, dcgettext, and gettext_noop. See the -k/--keyword flag
below for how to augment this.

(I have never used either, I just spent a few minutes trying to be
helpful =P)

Re: [pygettext] --package-name and --package-version unknown

<u32hak$glk$2@nnrp.usenet.blueworldhosting.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!nnrp.usenet.blueworldhosting.com!.POSTED!not-for-mail
From: aapost@idontexist.club (aapost)
Newsgroups: comp.lang.python
Subject: Re: [pygettext] --package-name and --package-version unknown
Date: Fri, 5 May 2023 05:12:52 -0400
Organization: BlueWorld Hosting Usenet (https://usenet.blueworldhosting.com)
Message-ID: <u32hak$glk$2@nnrp.usenet.blueworldhosting.com>
References: <27f92c2565e5256cc1263aa9a996550a@posteo.de>
<mailman.31.1683240384.13552.python-list@python.org>
<u31ls1$2oc5$1@nnrp.usenet.blueworldhosting.com>
<4083df1963eba88c54c833c7c2f04e34@posteo.de>
<mailman.34.1683276003.13552.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 5 May 2023 09:12:52 -0000 (UTC)
Injection-Info: nnrp.usenet.blueworldhosting.com;
logging-data="17076"; mail-complaints-to="usenet@blueworldhosting.com"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.10.0
Cancel-Lock: sha1:BgvVbV0IUqzmJl7Gemyv1ec5jUo= sha256:vxzYShSYZph7Mip0Esizgxe2puSCN1mAja43C70vN78=
sha1:YJk5NvQ8Uu8FMC1BclqyOpjJX00= sha256:s0mQa3qQbDg4Ht0Hynoq9jBySC15voTToJNPgl0qJz0=
Content-Language: en-US
In-Reply-To: <mailman.34.1683276003.13552.python-list@python.org>
 by: aapost - Fri, 5 May 2023 09:12 UTC

On 5/5/23 04:39, c.buhtz@posteo.jp wrote:
>
That being said, the git repo linked earlier has accepted commits to
that file earlier this year. So read in to that what you will *shrugs*


devel / comp.lang.python / Re: [pygettext] --package-name and --package-version unknown

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor