3 %bcond_without python2 # CPython 2.x module
4 %bcond_without python3 # CPython 3.x module
6 %define module colorama
7 Summary: Cross-platform colored terminal text
8 Summary(pl.UTF-8): Wieloplatformowe kolorowanie tekstu na terminalu
13 Group: Libraries/Python
14 #Source0Download: https://pypi.org/simple/colorama/
15 Source0: https://files.pythonhosted.org/packages/source/c/colorama/%{module}-%{version}.tar.gz
16 # Source0-md5: 57b22f2597f63df051b69906fbf310cc
17 URL: https://github.com/tartley/colorama
18 BuildRequires: rpm-pythonprov
19 BuildRequires: rpmbuild(macros) >= 1.714
21 BuildRequires: python-modules >= 1:2.7
22 BuildRequires: python-setuptools
25 BuildRequires: python3-modules >= 1:3.5
26 BuildRequires: python3-setuptools
28 BuildRequires: sed >= 4.0
29 Requires: python-modules >= 1:2.7
31 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
34 ANSI escape character sequences have long been used to produce colored
35 terminal text and cursor positioning on Unix and Macs. Colorama makes
36 this work on Windows, too, by wrapping stdout, stripping ANSI
37 sequences it finds (which otherwise show up as gobbledygook in your
38 output), and converting them into the appropriate Win32 calls to
39 modify the state of the terminal. On other platforms, Colorama does
42 Colorama also provides some shortcuts to help generate ANSI sequences
43 but works fine in conjunction with any other ANSI sequence generation
44 library, such as Termcolor (<https://pypi.org/project/termcolor/>).
46 This has the upshot of providing a simple cross-platform API for
47 printing colored terminal text from Python, and has the happy
48 side-effect that existing applications or libraries which use ANSI
49 sequences to produce colored output on Linux or Macs can now also work
50 on Windows, simply by calling colorama.init().
52 %description -l pl.UTF-8
53 Do wyświetlania kolorowego tekstu na terminalu oraz przesuwania
54 kursora w systemach Unix i Mac od dawna używane są sekwencje ANSI.
55 Colorama sprawia, że działa to także pod Windows - poprzez
56 przechwycenie stdout, wycinanie znalezionych sekwencji ANSI (które w
57 przeciwnym wypadku wyświetliłyby się jako bełkot) i przekształcanie
58 ich na odpowiednie wywołania Win32, modyfikujące stan terminala. Na
59 innych platformach Colorama nie robi nic.
61 Colorama zapewnia też pewne ułatwienia do generowania sekwencji ANSI,
62 ale działa dobrze w połączeniu z dowolną inną biblioteką generującą
63 sekwencje ANSI, taką jak Termcolor
64 (<https://pypi.org/project/termcolor/>).
66 Efektem jest zapewnienie prostego, wieloplatformowego API do
67 wypisywania kolorowego tekstu z Pythona, co ma miły efekt uboczny, że
68 istniejące aplikacje czy biblioteki wykorzystujące sekwencje ANSI do
69 tworzenia kolorowego wyjścia pod systemem Linux czy Mac będą teraz
70 działać także pod Windows dzięki prostemu wywołaniu colorama.init().
72 %package -n python3-%{module}
73 Summary: Cross-platform colored terminal text
74 Summary(pl.UTF-8): Wieloplatformowe kolorowanie tekstu na terminalu
75 Group: Libraries/Python
76 Requires: python3-modules >= 1:3.5
78 %description -n python3-%{module}
79 ANSI escape character sequences have long been used to produce colored
80 terminal text and cursor positioning on Unix and Macs. Colorama makes
81 this work on Windows, too, by wrapping stdout, stripping ANSI
82 sequences it finds (which otherwise show up as gobbledygook in your
83 output), and converting them into the appropriate win32 calls to
84 modify the state of the terminal. On other platforms, Colorama does
87 Colorama also provides some shortcuts to help generate ANSI sequences
88 but works fine in conjunction with any other ANSI sequence generation
89 library, such as Termcolor (<https://pypi.org/project/termcolor/>).
91 This has the upshot of providing a simple cross-platform API for
92 printing colored terminal text from Python, and has the happy
93 side-effect that existing applications or libraries which use ANSI
94 sequences to produce colored output on Linux or Macs can now also work
95 on Windows, simply by calling colorama.init().
97 %description -n python3-%{module} -l pl.UTF-8
98 Do wyświetlania kolorowego tekstu na terminalu oraz przesuwania
99 kursora w systemach Unix i Mac od dawna używane są sekwencje ANSI.
100 Colorama sprawia, że działa to także pod Windows - poprzez
101 przechwycenie stdout, wycinanie znalezionych sekwencji ANSI (które w
102 przeciwnym wypadku wyświetliłyby się jako bełkot) i przekształcanie
103 ich na odpowiednie wywołania Win32, modyfikujące stan terminala. Na
104 innych platformach Colorama nie robi nic.
106 Colorama zapewnia też pewne ułatwienia do generowania sekwencji ANSI,
107 ale działa dobrze w połączeniu z dowolną inną biblioteką generującą
108 sekwencje ANSI, taką jak Termcolor
109 (<https://pypi.org/project/termcolor/>).
111 Efektem jest zapewnienie prostego, wieloplatformowego API do
112 wypisywania kolorowego tekstu z Pythona, co ma miły efekt uboczny, że
113 istniejące aplikacje czy biblioteki wykorzystujące sekwencje ANSI do
114 tworzenia kolorowego wyjścia pod systemem Linux czy Mac będą teraz
115 działać także pod Windows dzięki prostemu wywołaniu colorama.init().
118 %setup -q -n %{module}-%{version}
120 %{__sed} -i -e '1s,/usr/bin/env bash,/bin/sh,' demos/demo.sh
132 rm -rf $RPM_BUILD_ROOT
139 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
140 cp -a demos/*.{py,sh} $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
141 %{__sed} -i -e '1s,/usr/bin/python,%{__python},' $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}/*.py
142 %{__sed} -i -e 's,^python ,%{__python},' $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}/demo.sh
148 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
149 cp -a demos/*.{py,sh} $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
150 %{__sed} -i -e '1s,/usr/bin/python,%{__python3},' $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}/*.py
151 %{__sed} -i -e 's,^python ,%{__python3},' $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}/demo.sh
155 rm -rf $RPM_BUILD_ROOT
159 %defattr(644,root,root,755)
160 %doc CHANGELOG.rst LICENSE.txt README.rst
161 %dir %{py_sitescriptdir}/%{module}
162 %{py_sitescriptdir}/%{module}/*.py[co]
163 %{py_sitescriptdir}/%{module}-*.egg-info
164 %{_examplesdir}/%{name}-%{version}
168 %files -n python3-%{module}
169 %defattr(644,root,root,755)
170 %doc CHANGELOG.rst LICENSE.txt README.rst
171 %{py3_sitescriptdir}/%{module}
172 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
173 %{_examplesdir}/python3-%{module}-%{version}