New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3.7 and pyroute2 #467

Closed
fedya opened this Issue Mar 6, 2018 · 17 comments

Comments

Projects
4 participants
@fedya
Copy link

fedya commented Mar 6, 2018

-bash-4.4$ /usr/bin/mock -v --configdir=/etc/mock/ --buildsrpm --spec=/home/omv/htop/htop.spec --sources=/home/omv/htop --no-cleanup-after --resultdir=/home/omv/output
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 79, in <module>
    from mockbuild import util
  File "/usr/lib/python3.7/site-packages/mockbuild/util.py", line 41, in <module>
    from pyroute2 import IPRoute
  File "/usr/lib/python3.7/site-packages/pyroute2/__init__.py", line 19, in <module>
    from pyroute2.iproute import (IPRoute,
  File "/usr/lib/python3.7/site-packages/pyroute2/iproute.py", line 230, in <module>
    from pyroute2.netlink.rtnl.iprsocket import IPRSocket
  File "/usr/lib/python3.7/site-packages/pyroute2/netlink/rtnl/iprsocket.py", line 49
    def bind(self, groups=rtnl.RTNL_GROUPS, async=False):
                                                ^
SyntaxError: invalid syntax
@vodik

This comment has been minimized.

Copy link
Contributor

vodik commented Mar 6, 2018

Yeah, async is a keyword now.

@svinota

This comment has been minimized.

Copy link
Owner

svinota commented Mar 23, 2018

A good question, what to do now without breakin' all the things.

(3.8) [peet@svinosund pyroute2] {master} $ flake8 pyroute2/
pyroute2/devlink.py:20:19: E999 SyntaxError: invalid syntax
pyroute2/iwutil.py:156:19: E999 SyntaxError: invalid syntax
pyroute2/netlink/nlsocket.py:929:44: E999 SyntaxError: invalid syntax
pyroute2/netlink/nl80211/__init__.py:641:34: E999 SyntaxError: invalid syntax
pyroute2/netlink/generic/__init__.py:29:62: E999 SyntaxError: invalid syntax
pyroute2/netlink/rtnl/iprsocket.py:49:49: E999 SyntaxError: invalid syntax
pyroute2/netlink/rtnl/riprsocket.py:13:49: E999 SyntaxError: invalid syntax
pyroute2/netlink/devlink/__init__.py:129:34: E999 SyntaxError: invalid syntax
pyroute2/netlink/event/__init__.py:21:34: E999 SyntaxError: invalid syntax
pyroute2/ipdb/main.py:866:59: E999 SyntaxError: invalid syntax

First, I plan to add an alias to that argument and raise a deprecation warning in the case of the keyword usage. And let's hope 3.7 will not come too soon, so everyone will have time to fix own code in the case the keyword is used.

@svinota svinota added the bug label Mar 23, 2018

@hroncok

This comment has been minimized.

Copy link

hroncok commented May 29, 2018

Hi. Any update on this? Do you need help? 3.7 is approaching and we would like to have it in Fedora soon, but this would block us.

@hroncok

This comment has been minimized.

@svinota

This comment has been minimized.

Copy link
Owner

svinota commented May 29, 2018

@hroncok yep, will be fixed asap in the master branch.

@hroncok

This comment has been minimized.

Copy link

hroncok commented May 29, 2018

Oh I see now you are the Fedora maintainer and upstream owner as well. Excellent!

@hroncok

This comment has been minimized.

Copy link

hroncok commented May 29, 2018

I have an idea about a decorator that might help... give me a minute.

@hroncok

This comment has been minimized.

Copy link

hroncok commented May 29, 2018

import functools
import warnings


def deprecated_async(func):
    @functools.wraps(func)
    def inner(*args, **kwargs):
        if 'async' in kwargs:
            if 'async_' in kwargs:
                raise ValueError('cannot use both async and async_ keyword '
                                 'arguments! the latter obsoletes the first.')
            warnings.warn('async keyword argumnt is deprecated, use async_ '
                          'instead', DeprecationWarning)
            kwargs['async_'] = kwargs['async']
            del kwargs['async']
        return func(*args, **kwargs)
    return inner


@deprecated_async
def foo(a, b, async_):
    return a, b, async_


print(foo(1, 2, async_=True))
print(foo(1, 2, async=True))
@hroncok

This comment has been minimized.

Copy link

hroncok commented May 29, 2018

May I submit a PR in this manner?

@svinota

This comment has been minimized.

Copy link
Owner

svinota commented May 29, 2018

Sorry, was busy testing another change

Almost the same idea, but w/o a decorator

@hroncok

This comment has been minimized.

Copy link

hroncok commented May 29, 2018

Whatever works for you. The decorator was there because of DRY.

@svinota

This comment has been minimized.

Copy link
Owner

svinota commented May 29, 2018

@hroncok btw do you know anyone who could become the package maintainer in RH? I have almost no time to update the package as new releases of the library come, so it's quite ancient in the Fedora repo

@hroncok

This comment has been minimized.

Copy link

hroncok commented May 29, 2018

You mean if a redhatter could help you maintain the package in Fedora? Since mock requires this, I guess @xsuchy should be able to get someone. Also don't hesitate to make the python-sig FAS group an admin.

@svinota

This comment has been minimized.

Copy link
Owner

svinota commented May 29, 2018

Ok, I do that now.

Another question — does it wait until the next weekend (10.06) to cut the next release? Or to release asap?

@svinota

This comment has been minimized.

Copy link
Owner

svinota commented May 29, 2018

@hroncok I made the python-sig group admin on the https://src.fedoraproject.org/rpms/python-pyroute2 , thanks for the hint

@hroncok

This comment has been minimized.

Copy link

hroncok commented May 29, 2018

does it wait until the next weekend (10.06) to cut the next release

Yes. if not, I can always take the patch and apply it in Fedora.

Thanks

@svinota

This comment has been minimized.

Copy link
Owner

svinota commented May 29, 2018

@hroncok ping me pls if there will be any issues or if the release will be needed earlier.

Thanks

@svinota svinota added this to To do in 0.5.2 via automation May 29, 2018

@svinota svinota added the fixed label May 29, 2018

@svinota svinota closed this May 29, 2018

0.5.2 automation moved this from To do to Done May 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment