Bug 1622043 - ovirt-engine-sdk-python use python 3.7 reserved words
Summary: ovirt-engine-sdk-python use python 3.7 reserved words
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine-sdk-python
Classification: oVirt
Component: General
Version: 4.2.8
Hardware: All
OS: All
unspecified
high vote
Target Milestone: ovirt-4.3.0
: ---
Assignee: Ondra Machacek
QA Contact: Jan Zmeskal
URL:
Whiteboard:
Depends On:
Blocks: TRACKER-bugs-affecting-libguestfs 1641477
TreeView+ depends on / blocked
 
Reported: 2018-08-24 09:08 UTC by Konstantin Shalygin
Modified: 2019-02-21 14:17 UTC (History)
8 users (show)

Fixed In Version: python-ovirt-engine-sdk4-4.3.0
Doc Type: If docs needed, set a value
Doc Text:
When using Python SDK with Python 3.7, you cannot use async parameter of service methods, as it was renamed to async_, because Python 3.7 come with reserver keyword async. In older Python versions you can still use async in SDK service methods, but you can also use async_.
Clone Of:
: 1641477 (view as bug list)
Environment:
Last Closed: 2019-02-21 14:17:14 UTC
oVirt Team: Infra
rule-engine: ovirt-4.3+


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 94800 master MERGED Add async Python 3.7 reserved keyword 2020-05-06 18:12:21 UTC

Description Konstantin Shalygin 2018-08-24 09:08:42 UTC
Description of problem:

Since python 3.7 ovirt-engine-sdk-python is unusable and should be updated because used reserved python words as arguments.

Why Severity is high: many desktop distro's at this time use python 3.7 as default python interpretator and this breaks all oVirt modules for Ansible.

Version-Release number of selected component (if applicable):

ovirt-engine-sdk-python-4.2.8

How reproducible:

Build ovirt-engine-sdk-python with python 3.7

```
4.2.8
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/writers.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/writer.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/version.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/types.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/services.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/service.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/readers.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/reader.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/http.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
copying lib/ovirtsdk4/__init__.py -> build/lib.linux-x86_64-3.7/ovirtsdk4
running build_ext
building 'ovirtsdk4.xml' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/ext
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/libxml2 -I/usr/include/python3.7m -c ext/xml.c -o build/temp.linux-x86_64-3.7/ext/xml.o
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/libxml2 -I/usr/include/python3.7m -c ext/ov_xml_writer.c -o build/temp.linux-x86_64-3.7/ext/ov_xml_writer.o
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/libxml2 -I/usr/include/python3.7m -c ext/ov_xml_utils.c -o build/temp.linux-x86_64-3.7/ext/ov_xml_utils.o
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/libxml2 -I/usr/include/python3.7m -c ext/ov_xml_reader.c -o build/temp.linux-x86_64-3.7/ext/ov_xml_reader.o
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/libxml2 -I/usr/include/python3.7m -c ext/ov_xml_module.c -o build/temp.linux-x86_64-3.7/ext/ov_xml_module.o
gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.7/ext/xml.o build/temp.linux-x86_64-3.7/ext/ov_xml_writer.o build/temp.linux-x86_64-3.7/ext/ov_xml_utils.o build/temp.linux-x86_64-3.7/ext/ov_xml_reader.o build/temp.linux-x86_64-3.7/ext/ov_xml_module.o -L/usr/lib -lxml2 -lpython3.7m -o build/lib.linux-x86_64-3.7/ovirtsdk4/xml.cpython-37m-x86_64-linux-gnu.so
running install_lib
creating /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr
creating /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib
creating /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7
creating /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages
creating /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/xml.cpython-37m-x86_64-linux-gnu.so -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/__init__.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/http.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/reader.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/readers.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/service.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/services.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/types.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/version.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/writer.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
copying build/lib.linux-x86_64-3.7/ovirtsdk4/writers.py -> /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4
byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/__init__.py to __init__.cpython-37.pyc
byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/http.py to http.cpython-37.pyc
byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/reader.py to reader.cpython-37.pyc
byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/readers.py to readers.cpython-37.pyc
  File "/usr/lib/python3.7/site-packages/ovirtsdk4/readers.py", line 58
    obj.async = Reader.read_boolean(reader)
            ^
SyntaxError: invalid syntax

byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/service.py to service.cpython-37.pyc
byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/services.py to services.cpython-37.pyc
  File "/usr/lib/python3.7/site-packages/ovirtsdk4/services.py", line 82
    async=None,
        ^
SyntaxError: invalid syntax

byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/types.py to types.cpython-37.pyc
  File "/usr/lib/python3.7/site-packages/ovirtsdk4/types.py", line 13065
    async=None,
        ^
SyntaxError: invalid syntax

byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/version.py to version.cpython-37.pyc
byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/writer.py to writer.cpython-37.pyc
byte-compiling /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirtsdk4/writers.py to writers.cpython-37.pyc
  File "/usr/lib/python3.7/site-packages/ovirtsdk4/writers.py", line 42
    if obj.async is not None:
               ^
SyntaxError: invalid syntax

writing byte-compilation script '/tmp/tmp602b1jz5.py'
/usr/bin/python /tmp/tmp602b1jz5.py
  File "/usr/lib/python3.7/site-packages/ovirtsdk4/readers.py", line 58
    obj.async = Reader.read_boolean(reader)
            ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.7/site-packages/ovirtsdk4/services.py", line 82
    async=None,
        ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.7/site-packages/ovirtsdk4/types.py", line 13065
    async=None,
        ^
SyntaxError: invalid syntax

  File "/usr/lib/python3.7/site-packages/ovirtsdk4/writers.py", line 42
    if obj.async is not None:
               ^
SyntaxError: invalid syntax

removing /tmp/tmp602b1jz5.py
running install_egg_info
running egg_info
writing lib/ovirt_engine_sdk_python.egg-info/PKG-INFO
writing dependency_links to lib/ovirt_engine_sdk_python.egg-info/dependency_links.txt
writing requirements to lib/ovirt_engine_sdk_python.egg-info/requires.txt
writing top-level names to lib/ovirt_engine_sdk_python.egg-info/top_level.txt
reading manifest file 'lib/ovirt_engine_sdk_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'lib/ovirt_engine_sdk_python.egg-info/SOURCES.txt'
Copying lib/ovirt_engine_sdk_python.egg-info to /tmp/python-ovirt-engine-sdk/pkg/python-ovirt-engine-sdk/usr/lib/python3.7/site-packages/ovirt_engine_sdk_python-4.2.8-py3.7.egg-info
running install_scripts
```

Actual results:

```
Python 3.7.0 (default, Jul 15 2018, 10:44:58) 
[GCC 8.1.1 20180531] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ovirtsdk4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/site-packages/ovirtsdk4/__init__.py", line 1032, in <module>
    from ovirtsdk4 import readers  # noqa: F401
  File "/usr/lib/python3.7/site-packages/ovirtsdk4/readers.py", line 58
    obj.async = Reader.read_boolean(reader)
            ^
SyntaxError: invalid syntax
```

Expected results:

ovirtsdk4 imported without issues

Additional info:

Comment 3 Konstantin Shalygin 2019-02-11 08:32:09 UTC
Version 4.3.0 works for me.
Thanks.

Comment 4 Jan Zmeskal 2019-02-14 14:36:28 UTC
Verification steps: 

1. Create CentOS7 machine

2. Install python3.7 prerequisities
yum install -y gcc openssl-devel bzip2-devel libffi-devel

3. Get python3.7 source
cd /usr/src
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar xzf Python-3.7.0.tgz

4. Compile python3.7
cd Python-3.7.0
./configure --enable-optimizations
make altinstall

5. Verify installation
python3.7 -V

6. Get python SDK source 
cd /tmp
wget --no-check-certificate https://files.pythonhosted.org/packages/53/06/4faf279a5e58c7a6a28fcc865ba3b5b69c39ee786a5043ab1ccfb5d8c75e/ovirt-engine-sdk-python-4.3.0.tar.gz
tar xzf ovirt-engine-sdk-python-4.3.0.tar.gz

7. Compile python SDK
cd ovirt-engine-sdk-python-4.3.0
yum install libxml2-devel libcurl-devel
export PYCURL_SSL_LIBRARY=openssl
python3.7 setup.py install

8. Verify that everything worked in python interactive session
python3.7
Python 3.7.0 (default, Feb 14 2019, 15:08:49) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ovirtsdk4
>>>

Comment 5 Sandro Bonazzola 2019-02-21 14:17:14 UTC
This bugzilla is included in oVirt 4.3.0 release, published on February 4th 2019.

Since the problem described in this bug report should be
resolved in oVirt 4.3.0 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.