Bug 25539

Summary: Update candidate: python-curtsies fix for Python 3.6+ support (fixes bpython start)
Product: Mageia Reporter: Rémi Verschelde <rverschelde>
Component: RPM PackagesAssignee: QA Team <qa-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Normal CC: sysadmin-bugs, tarazed25, tmb
Version: 7Keywords: advisory, has_procedure, validated_update
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard: MGA7-64-OK
Source RPM: python-curtsies-0.3.0-3.mga7 CVE:
Status comment:

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