#2 Add deprecationwarning.patch
Closed 5 years ago by carlwgeorge. Opened 5 years ago by carmenbianca.
rpms/ carmenbianca/python-prompt_toolkit f29  into  f29

@@ -0,0 +1,20 @@ 

+ ---

+  prompt_toolkit/styles/from_dict.py |    5 ++++-

+  1 file changed, 4 insertions(+), 1 deletion(-)

+ 

+ Index: prompt_toolkit-1.0.15/prompt_toolkit/styles/from_dict.py

+ ===================================================================

+ --- prompt_toolkit-1.0.15.orig/prompt_toolkit/styles/from_dict.py	2019-04-08 19:44:07.417924677 +0200

+ +++ prompt_toolkit-1.0.15/prompt_toolkit/styles/from_dict.py	2019-04-08 19:48:54.632773366 +0200

+ @@ -6,7 +6,10 @@ This is very similar to the Pygments sty

+  - Support for ANSI color names. (These will map directly to the 16 terminal

+    colors.)

+  """

+ -from collections import Mapping

+ +try:

+ +    from collections.abc import Mapping

+ +except ImportError:

+ +    from collections import Mapping

+  

+  from .base import Style, DEFAULT_ATTRS, ANSI_COLOR_NAMES

+  from .defaults import DEFAULT_STYLE_EXTENSIONS

file modified
+7 -1
@@ -16,12 +16,14 @@ 

  

  Name:           python-%{pkgname}

  Version:        1.0.15

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        Library for building powerful interactive command lines in Python

  License:        BSD

  URL:            https://github.com/jonathanslenders/python-prompt-toolkit

  Source0:        %pypi_source

  BuildArch:      noarch

+ # https://github.com/prompt-toolkit/python-prompt-toolkit/issues/871

+ Patch0:         deprecationwarning.patch

  

  %description %{_description}

  
@@ -57,6 +59,7 @@ 

  

  %prep

  %setup -q -n %{srcname}-%{version}

+ %patch0 -p1

  rm -r %{eggname}.egg-info

  

  %build
@@ -84,6 +87,9 @@ 

  %{python3_sitelib}/%{eggname}-%{version}-py%{python3_version}.egg-info

  

  %changelog

+ * Mon Apr 08 2019 Carmen Bianca Bakker <carmenbianca@fedoraproject.org> - 1.0.15-2

+ - Added deprecationwarning.patch to suppress a DeprecationWarning.

+ 

  * Thu Jul 12 2018 Carl George <carl@george.computer> - 1.0.15-1

  - Latest upstream

  - Use common documentation directory

Copied comment from https://github.com/prompt-toolkit/python-prompt-toolkit/issues/871:

I am trying to run xonsh 0.8.12 on Fedora 29 using prompt-toolkit 1.0.15. When I launch xonsh, I get the following output:

$ /bin/xonsh
/usr/lib/python3.7/site-packages/prompt_toolkit/styles/from_dict.py:9: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Mapping
carmen@carmen-thinkpad ~/Projektoj/xonsh.bak f30 $

I have reported the bug at https://bugzilla.redhat.com/show_bug.cgi?id=1697574

I have a fix for the bug at https://src.fedoraproject.org/rpms/python-prompt_toolkit/pull-request/2

---
 prompt_toolkit/styles/from_dict.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Index: prompt_toolkit-1.0.15/prompt_toolkit/styles/from_dict.py
===================================================================
--- prompt_toolkit-1.0.15.orig/prompt_toolkit/styles/from_dict.py   2019-04-08 19:44:07.417924677 +0200
+++ prompt_toolkit-1.0.15/prompt_toolkit/styles/from_dict.py    2019-04-08 19:48:54.632773366 +0200
@@ -6,7 +6,10 @@ This is very similar to the Pygments sty
 - Support for ANSI color names. (These will map directly to the 16 terminal
   colors.)
 """
-from collections import Mapping
+try:
+    from collections.abc import Mapping
+except ImportError:
+    from collections import Mapping

 from .base import Style, DEFAULT_ATTRS, ANSI_COLOR_NAMES
 from .defaults import DEFAULT_STYLE_EXTENSIONS

1 new commit added

  • Change patch comment to bug URL
5 years ago

Done. Initially misinterpreted it and changed the top comment of this bug report, but that should be all right :p

Thanks again for sending this upstream. They've released 1.0.16 with the fix. I've updated the spec file to this version in 03e02a, so this pull request is no longer necessary.

Pull-Request has been closed by carlwgeorge

5 years ago