]> git.pld-linux.org Git - SPECS.git/blob - python-colorama.spec
SPECS updated Wed 28 Jul 14:48:01 CEST 2021
[SPECS.git] / python-colorama.spec
1 #
2 # Conditional build:
3 %bcond_without  python2 # CPython 2.x module
4 %bcond_without  python3 # CPython 3.x module
5
6 %define         module          colorama
7 Summary:        Cross-platform colored terminal text
8 Summary(pl.UTF-8):      Wieloplatformowe kolorowanie tekstu na terminalu
9 Name:           python-%{module}
10 Version:        0.4.4
11 Release:        1
12 License:        BSD
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
20 %if %{with python2}
21 BuildRequires:  python-modules >= 1:2.7
22 BuildRequires:  python-setuptools
23 %endif
24 %if %{with python3}
25 BuildRequires:  python3-modules >= 1:3.5
26 BuildRequires:  python3-setuptools
27 %endif
28 BuildRequires:  sed >= 4.0
29 Requires:       python-modules >= 1:2.7
30 BuildArch:      noarch
31 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
32
33 %description
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
40 nothing.
41
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/>).
45
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().
51
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.
60
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/>).
65
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().
71
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
77
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
85 nothing.
86
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/>).
90
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().
96
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.
105
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/>).
110
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().
116
117 %prep
118 %setup -q -n %{module}-%{version}
119
120 %{__sed} -i -e '1s,/usr/bin/env bash,/bin/sh,' demos/demo.sh
121
122 %build
123 %if %{with python2}
124 %py_build
125 %endif
126
127 %if %{with python3}
128 %py3_build
129 %endif
130
131 %install
132 rm -rf $RPM_BUILD_ROOT
133
134 %if %{with python2}
135 %py_install
136
137 %py_postclean
138
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
143 %endif
144
145 %if %{with python3}
146 %py3_install
147
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
152 %endif
153
154 %clean
155 rm -rf $RPM_BUILD_ROOT
156
157 %if %{with python2}
158 %files
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}
165 %endif
166
167 %if %{with python3}
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}
174 %endif
This page took 0.40123 seconds and 3 git commands to generate.