Skip to content
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

Trouble building rpms on Centos 7.3 #88

Closed
jnaulty opened this issue Sep 7, 2017 · 10 comments · Fixed by #198
Closed

Trouble building rpms on Centos 7.3 #88

jnaulty opened this issue Sep 7, 2017 · 10 comments · Fixed by #198

Comments

@jnaulty
Copy link

jnaulty commented Sep 7, 2017

I am trying to build the rpm for this project for python 2.7
when running command:
python setup.py bdist_rpm --python /usr/bin/python

I receive the error

+ cd tenacity-4.4.1.dev1
+ /usr/bin/python setup.py install --single-version-externally-managed -O1 --root=/home/jnaulty/workspace/tenacity/build/bdist.linux-x86_64/rpm/BUILDROOT/tenacity-4.4.1.dev1-1.x86_64 --record=INSTALLED_FILES
  File "/usr/lib/python2.7/site-packages/tenacity/tests/test_async.py", line 39
    yield from asyncio.sleep(0.00001)
             ^
SyntaxError: invalid syntax

  File "/usr/lib/python2.7/site-packages/tenacity/async.py", line 44
    result = yield from fn(*args, **kwargs)
                      ^
SyntaxError: invalid syntax

  File "/usr/lib/python2.7/site-packages/tenacity/tests/test_async.py", line 39
    yield from asyncio.sleep(0.00001)
             ^
SyntaxError: invalid syntax

  File "/usr/lib/python2.7/site-packages/tenacity/async.py", line 44
    result = yield from fn(*args, **kwargs)
                      ^
SyntaxError: invalid syntax

+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /home/jnaulty/workspace/tenacity/build/bdist.linux-x86_64/rpm/BUILD/tenacity-4.4.1.dev1
find: 'debug': No such file or directory
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
error: Bad exit status from /var/tmp/rpm-tmp.8cn8w2 (%install)
    Bad exit status from /var/tmp/rpm-tmp.8cn8w2 (%install)
error: command 'rpmbuild' failed with exit status 1

What is the workaround for this?

@vicyap
Copy link

vicyap commented Sep 21, 2017

yield from syntax is a >= Python 3.3 syntax, which will not work for Python 2.7. I'm not sure what the usual solution to this problem would be. Maybe something in setup.py can fix this?

jnaulty added a commit to jnaulty/tenacity that referenced this issue Oct 4, 2017
jnaulty added a commit to jnaulty/tenacity that referenced this issue Oct 4, 2017
jnaulty added a commit to jnaulty/tenacity that referenced this issue Oct 5, 2017
jnaulty added a commit to jnaulty/tenacity that referenced this issue Oct 5, 2017
jnaulty added a commit to jnaulty/tenacity that referenced this issue Oct 5, 2017
@jnaulty
Copy link
Author

jnaulty commented Oct 5, 2017

Taking a look at other projects and their solutions: https://github.com/kennethreitz/tablib/blob/master/tablib/compat.py

@jd
Copy link
Owner

jd commented Oct 5, 2017

Well this is code compatibility, that's easy enough. Tenacity uses https://pypi.python.org/pypi/six for that.

Problem is that it does not cover syntax changes like this is the problem here.

@jd
Copy link
Owner

jd commented Oct 13, 2017

@hguemar Do you have any idea on how to fix that?

@RonnyPfannschmidt
Copy link

easiest way would be to just delete the file in the rpm spec for the python2 build

@coreycb
Copy link

coreycb commented Nov 8, 2017

I'm also hitting this when trying to package a new release for Ubuntu. It looks like there are a few areas where this syntax is used, making the code incompatible for python 2.

tenacity/tests/test_async.py:    yield from asyncio.sleep(0.00001)
tenacity/tests/test_async.py:        yield from _retryable_coroutine(thing)
tenacity/async.py:                    result = yield from fn(*args, **kwargs)
tenacity/async.py:                yield from self.sleep(do)

@mrunge
Copy link

mrunge commented Jul 19, 2018

Fedora now switched to python 3.7, tenacity 4.9 uses async.

@jd jd closed this as completed Jul 20, 2018
@jd jd added the help wanted label Jul 20, 2018
@jd jd reopened this Jul 20, 2018
jnaulty added a commit to jnaulty/tenacity that referenced this issue Aug 7, 2018
jnaulty added a commit to jnaulty/tenacity that referenced this issue Aug 7, 2018
to test on centos build with python2 and python3

e.g.
python2:
`python setup.py bdist_rpm --python /usr/bin/python2`
python3:
`python setup.py bdist_rpm --python /usr/bin/python3`
@jnaulty
Copy link
Author

jnaulty commented Aug 7, 2018

opened a PR here: #133
This is the solution I'm using internally...not sure if it's the best way forward, but it works :)

@asqui
Copy link
Contributor

asqui commented Oct 30, 2019

Should Python 2 versions be removed from the specifiers if the library is not Py2 compatible (as of v4.10, according to kragniz/python-etcd3#429 )?

Actually, I see that the library is attempting to maintain Py2-compatibility by conditionally importing the _asyncio.py module, but the problem occurs if you try to proactively compile it. How about making _asyncio.py more robust to this?

@jd
Copy link
Owner

jd commented Oct 30, 2019

Tenacity is compatible with Python 2.

Don't trust everything you read on the internet.

asqui added a commit to BATS/tenacity that referenced this issue Oct 30, 2019
Use the same pattern of conditional importing of _compat.py as used in
__init__.py to ensure that _compat.py can be compiled on Python 2.

Fixes jd#88
asqui added a commit to BATS/tenacity that referenced this issue Oct 30, 2019
Use the same pattern of conditional importing of _compat.py as used in
__init__.py to ensure that _compat.py can be compiled on Python 2.

Fixes jd#88
@mergify mergify bot closed this as completed in #198 Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants