ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] python.req error
@ 2017-10-21  6:12 Антон Мидюков
  2017-10-21  6:32 ` Vitaly Kuznetsov
  0 siblings, 1 reply; 4+ messages in thread
From: Антон Мидюков @ 2017-10-21  6:12 UTC (permalink / raw)
  To: ALT Devel discussion list

Подскажите, пожалуйста, что не понравилось в синтаксисе python.req:

python.req: ERROR: 
/usr/src/tmp/Uranium-buildroot/usr/lib/uranium/plugins/LocalFileOutputDevice/LocalFileOutputDevice.py: 
invalid syntax (line 159)
Traceback (most recent call last):
   File "/usr/lib/rpm/python.req.py", line 230, in <module>
     lis = parser.suite('\n'.join(lines)+'\n').tolist(line_info=1)
   File "<string>", line 159
     raise 
OutputDeviceError.PermissionDeniedError(catalog.i18nc("@info:status 
Don't translate the XML tags <filename>!", "Permission denied when 
trying to save <filename>{0}</filename>").format(file_name)) from e
^
SyntaxError: invalid syntax


В терминале ^ указывает на from

Вот ссылка на эту строчку: 
https://github.com/Ultimaker/Uranium/blob/a228929a312a01f21b6024030c159714ca639f4e/plugins/LocalFileOutputDevice/LocalFileOutputDevice.py#L159

-- 
С уважением, Антон Мидюков <antohami@altlinux.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [devel] python.req error
  2017-10-21  6:12 [devel] python.req error Антон Мидюков
@ 2017-10-21  6:32 ` Vitaly Kuznetsov
  2017-10-21  8:00   ` Антон Мидюков
  0 siblings, 1 reply; 4+ messages in thread
From: Vitaly Kuznetsov @ 2017-10-21  6:32 UTC (permalink / raw)
  To: ALT Linux Team development discussions

On Sat, Oct 21, 2017 at 8:12 AM, Антон Мидюков <midyukov-anton@ya.ru> wrote:
> Подскажите, пожалуйста, что не понравилось в синтаксисе python.req:
>
> python.req: ERROR:
> /usr/src/tmp/Uranium-buildroot/usr/lib/uranium/plugins/LocalFileOutputDevice/LocalFileOutputDevice.py:
> invalid syntax (line 159)
> Traceback (most recent call last):
>   File "/usr/lib/rpm/python.req.py", line 230, in <module>
>     lis = parser.suite('\n'.join(lines)+'\n').tolist(line_info=1)
>   File "<string>", line 159
>     raise
> OutputDeviceError.PermissionDeniedError(catalog.i18nc("@info:status Don't
> translate the XML tags <filename>!", "Permission denied when trying to save
> <filename>{0}</filename>").format(file_name)) from e
> ^
> SyntaxError: invalid syntax
>

raise ... from - это конструкция Python3:
$ python2
Python 2.7.13 (default, Sep  5 2017, 08:53:59)
[GCC 7.1.1 20170622 (Red Hat 7.1.1-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
...     1/0
... except:
...     raise RuntimeError("Something bad happened") from None
  File "<stdin>", line 4
    raise RuntimeError("Something bad happened") from None
                                                    ^
SyntaxError: invalid syntax

$ python3
Python 3.6.2 (default, Oct  2 2017, 16:51:32)
[GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> try:
...     1/0
... except:
...    raise RuntimeError("Something bad happened") from None
...
Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
RuntimeError: Something bad happened

https://docs.python.org/3/reference/simple_stmts.html#raise
https://docs.python.org/2.7/reference/simple_stmts.html#raise


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [devel] python.req error
  2017-10-21  6:32 ` Vitaly Kuznetsov
@ 2017-10-21  8:00   ` Антон Мидюков
  2017-10-22  3:46     ` Антон Мидюков
  0 siblings, 1 reply; 4+ messages in thread
From: Антон Мидюков @ 2017-10-21  8:00 UTC (permalink / raw)
  To: devel

21.10.2017 13:32, Vitaly Kuznetsov пишет:
> On Sat, Oct 21, 2017 at 8:12 AM, Антон Мидюков <midyukov-anton@ya.ru> wrote:
>> Подскажите, пожалуйста, что не понравилось в синтаксисе python.req:
>>
>> python.req: ERROR:
>> /usr/src/tmp/Uranium-buildroot/usr/lib/uranium/plugins/LocalFileOutputDevice/LocalFileOutputDevice.py:
>> invalid syntax (line 159)
>> Traceback (most recent call last):
>>    File "/usr/lib/rpm/python.req.py", line 230, in <module>
>>      lis = parser.suite('\n'.join(lines)+'\n').tolist(line_info=1)
>>    File "<string>", line 159
>>      raise
>> OutputDeviceError.PermissionDeniedError(catalog.i18nc("@info:status Don't
>> translate the XML tags <filename>!", "Permission denied when trying to save
>> <filename>{0}</filename>").format(file_name)) from e
>> ^
>> SyntaxError: invalid syntax
>>
> raise ... from - это конструкция Python3:

Понятно. А как мне сказать python.req, что этот файл написан на python3? 
Я пакет собираю для python3 исключительно.
> $ python2
> Python 2.7.13 (default, Sep  5 2017, 08:53:59)
> [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> try:
> ...     1/0
> ... except:
> ...     raise RuntimeError("Something bad happened") from None
>    File "<stdin>", line 4
>      raise RuntimeError("Something bad happened") from None
>                                                      ^
> SyntaxError: invalid syntax
>
> $ python3
> Python 3.6.2 (default, Oct  2 2017, 16:51:32)
> [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> try:
> ...     1/0
> ... except:
> ...    raise RuntimeError("Something bad happened") from None
> ...
> Traceback (most recent call last):
>    File "<stdin>", line 4, in <module>
> RuntimeError: Something bad happened
>
> https://docs.python.org/3/reference/simple_stmts.html#raise
> https://docs.python.org/2.7/reference/simple_stmts.html#raise
> _______________________________________________
> Devel mailing list
> Devel@lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/devel

-- 
С уважением, Антон Мидюков <antohami@altlinux.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [devel] python.req error
  2017-10-21  8:00   ` Антон Мидюков
@ 2017-10-22  3:46     ` Антон Мидюков
  0 siblings, 0 replies; 4+ messages in thread
From: Антон Мидюков @ 2017-10-22  3:46 UTC (permalink / raw)
  To: devel

21.10.2017 15:00, Антон Мидюков пишет:
> Понятно. А как мне сказать python.req, что этот файл написан на 
> python3? Я пакет собираю для python3 исключительно.
>
Проблему решил так:
%add_python3_compile_include %_libexecdir/uranium

-- 
С уважением, Антон Мидюков <antohami@altlinux.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-22  3:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-21  6:12 [devel] python.req error Антон Мидюков
2017-10-21  6:32 ` Vitaly Kuznetsov
2017-10-21  8:00   ` Антон Мидюков
2017-10-22  3:46     ` Антон Мидюков

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git