Bug 25539 - Update candidate: python-curtsies fix for Python 3.6+ support (fixes bpython start)
Summary: Update candidate: python-curtsies fix for Python 3.6+ support (fixes bpython ...
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 7
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: MGA7-64-OK
Keywords: advisory, has_procedure, validated_update
Depends on:
Blocks:
 
Reported: 2019-10-09 11:45 CEST by Rémi Verschelde
Modified: 2019-10-23 23:08 CEST (History)
3 users (show)

See Also:
Source RPM: python-curtsies-0.3.0-3.mga7
CVE:
Status comment:


Attachments

Description Rémi Verschelde 2019-10-09 11:45:47 CEST
I noticed that `bpython3` from the `python3-bpython` package does not work on Mageia 7. It's because its dependency `python3-curtsies` requires the `typing` package, which is only needed for Python 2 or Python 3.5 or earlier.

Since Mageia 7 ships with Python 3.7, `bpython3` throws this error:
```
Traceback (most recent call last):
  File "/usr/bin/bpython", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3241, in <module>
    @_call_aside
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3225, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 583, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'typing' distribution was not found and is required by curtsies
```

I backported an upstream commit to fix it.

Advisory:
=========

Updated python-curtsies packages fix Python 3.7 support

  python3-curtsies required the 'typing' module which is now part of the
  standard library since Python 3.6, thus throwing an error when using it with
  Mageia 7's Python 3.7.

  This update fixes it, thereby fixing the launch of the bpython3 interpreter
  from the python3-bpython package.

References:

 - https://github.com/bpython/curtsies/commit/217b4f83e954837f8adc4c549c1f2f9f2bb272a7


RPMs in core/updates_testing:
=============================

python-curtsies-0.3.0-3.1.mga7
python3-curtsies-0.3.0-3.1.mga7

SRPM in core/updates_testing:
=============================

python-curtsies-0.3.0-3.1.mga7


Testing procedure:
==================

Launch `bpython3` from the python3-bpython package. Before the update, it should throw the above error. After the update, it should work fine (it's a Python interpreter, so it launches in the terminal - you can type python code and get nice hints and documentation).

The python2 version should be unaffected (can be checked with `bpython` from the bpython package).
Rémi Verschelde 2019-10-09 11:45:54 CEST

Keywords: (none) => has_procedure

Comment 1 Len Lawrence 2019-10-19 18:24:34 CEST
Mageia 7, x86_64
Thanks Rémi for the procedure.

Installed bpython and bpython3 from release, which pulled in the python?-curtsies packages.
Launched bpython and dropped a fibonacci sequence generator into it.
$ bpython
bpython version 0.18 on top of Python 2.7.16 /usr/bin/python2
>>> def fibo( ):
[...]
>>> fibo( )
<generator object fibo at 0x7f16ca004be0>
>>> import itertools
>>> print list( itertools.islice( fibo( ), 10 ) )
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
>>> exit( 0 )

$ bpython3
Traceback (most recent call last):
[...]
pkg_resources.DistributionNotFound: The 'typing' distribution was not found and is required by curtsies

Updated python?-curtsies.
Ran bpython with fibo( )
Worked fine, including hints.

$ bpython3
bpython version 0.18 on top of Python 3.7.3 /usr/bin/python3
>>> def fibo( ):
...       ''' Unbounded generator for Fibonacci numbers '''
...       x, y = 0, 1
...       while True:
...             yield x
...             x, y = y, x + y
... 
>>> if __name__ == "__main__":
...       import itertools
...       print( list( itertools.islice( fibo( ), 13 ) ) )
... 
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144]
>>> exit( 1 )

That worked fine but it was not as straightforward as it looks because initially it trapped a missing parentheses error in the print function (classic).  The error pointers were quite helpful in indicating the source of the problem.

Sorted for 64-bits.

Whiteboard: (none) => MGA7-64-OK
CC: (none) => tarazed25

Len Lawrence 2019-10-20 01:26:47 CEST

CC: (none) => sysadmin-bugs
Keywords: (none) => validated_update

Thomas Backlund 2019-10-23 19:43:07 CEST

Keywords: (none) => advisory
CC: (none) => tmb

Comment 2 Mageia Robot 2019-10-23 23:08:17 CEST
An update for this issue has been pushed to the Mageia Updates repository.

https://advisories.mageia.org/MGAA-2019-0171.html

Status: NEW => RESOLVED
Resolution: (none) => FIXED


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