]>
Commit | Line | Data |
---|---|---|
c3d23001 JR |
1 | # |
2 | # Conditional build: | |
c3d23001 JR |
3 | %bcond_without python2 # CPython 2.x module |
4 | %bcond_without python3 # CPython 3.x module | |
5 | ||
f7b361fb | 6 | %define module colorama |
c3d23001 | 7 | Summary: Cross-platform colored terminal text |
4ea1c680 | 8 | Summary(pl.UTF-8): Wieloplatformowe kolorowanie tekstu na terminalu |
c3d23001 | 9 | Name: python-%{module} |
a9968bc6 | 10 | Version: 0.4.4 |
ef1c446d | 11 | Release: 4 |
c3d23001 JR |
12 | License: BSD |
13 | Group: Libraries/Python | |
4ea1c680 JB |
14 | #Source0Download: https://pypi.org/simple/colorama/ |
15 | Source0: https://files.pythonhosted.org/packages/source/c/colorama/%{module}-%{version}.tar.gz | |
a9968bc6 | 16 | # Source0-md5: 57b22f2597f63df051b69906fbf310cc |
f7b361fb | 17 | URL: https://github.com/tartley/colorama |
c3d23001 | 18 | BuildRequires: rpm-pythonprov |
4ea1c680 | 19 | BuildRequires: rpmbuild(macros) >= 1.714 |
c3d23001 | 20 | %if %{with python2} |
4ea1c680 | 21 | BuildRequires: python-modules >= 1:2.7 |
f7b361fb | 22 | BuildRequires: python-setuptools |
c3d23001 JR |
23 | %endif |
24 | %if %{with python3} | |
0291ba8e | 25 | BuildRequires: python3-modules >= 1:3.5 |
f7b361fb | 26 | BuildRequires: python3-setuptools |
c3d23001 | 27 | %endif |
0291ba8e JB |
28 | BuildRequires: sed >= 4.0 |
29 | Requires: python-modules >= 1:2.7 | |
c3d23001 JR |
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 | |
4ea1c680 | 38 | output), and converting them into the appropriate Win32 calls to |
c3d23001 JR |
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 | |
0291ba8e | 44 | library, such as Termcolor (<https://pypi.org/project/termcolor/>). |
c3d23001 JR |
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 | |
f7b361fb ER |
49 | sequences to produce colored output on Linux or Macs can now also work |
50 | on Windows, simply by calling colorama.init(). | |
c3d23001 | 51 | |
4ea1c680 JB |
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 | |
0291ba8e | 64 | (<https://pypi.org/project/termcolor/>). |
4ea1c680 JB |
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 | ||
c3d23001 JR |
72 | %package -n python3-%{module} |
73 | Summary: Cross-platform colored terminal text | |
4ea1c680 | 74 | Summary(pl.UTF-8): Wieloplatformowe kolorowanie tekstu na terminalu |
c3d23001 | 75 | Group: Libraries/Python |
0291ba8e | 76 | Requires: python3-modules >= 1:3.5 |
c3d23001 JR |
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 | |
0291ba8e | 89 | library, such as Termcolor (<https://pypi.org/project/termcolor/>). |
c3d23001 JR |
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 | |
f7b361fb ER |
94 | sequences to produce colored output on Linux or Macs can now also work |
95 | on Windows, simply by calling colorama.init(). | |
c3d23001 | 96 | |
4ea1c680 JB |
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 | |
0291ba8e | 109 | (<https://pypi.org/project/termcolor/>). |
4ea1c680 JB |
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 | ||
c3d23001 JR |
117 | %prep |
118 | %setup -q -n %{module}-%{version} | |
119 | ||
0291ba8e JB |
120 | %{__sed} -i -e '1s,/usr/bin/env bash,/bin/sh,' demos/demo.sh |
121 | ||
c3d23001 JR |
122 | %build |
123 | %if %{with python2} | |
0291ba8e | 124 | %py_build |
c3d23001 JR |
125 | %endif |
126 | ||
127 | %if %{with python3} | |
0291ba8e | 128 | %py3_build |
c3d23001 JR |
129 | %endif |
130 | ||
131 | %install | |
132 | rm -rf $RPM_BUILD_ROOT | |
133 | ||
134 | %if %{with python2} | |
da038363 | 135 | %py_install |
0291ba8e | 136 | |
c3d23001 | 137 | %py_postclean |
0291ba8e JB |
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 | |
c3d23001 JR |
143 | %endif |
144 | ||
145 | %if %{with python3} | |
da038363 | 146 | %py3_install |
c3d23001 | 147 | |
c3d23001 | 148 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} |
0291ba8e JB |
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 | |
c3d23001 JR |
152 | %endif |
153 | ||
154 | %clean | |
155 | rm -rf $RPM_BUILD_ROOT | |
156 | ||
157 | %if %{with python2} | |
158 | %files | |
159 | %defattr(644,root,root,755) | |
4ea1c680 | 160 | %doc CHANGELOG.rst LICENSE.txt README.rst |
52c7cb20 | 161 | %dir %{py_sitescriptdir}/%{module} |
c3d23001 | 162 | %{py_sitescriptdir}/%{module}/*.py[co] |
c3d23001 | 163 | %{py_sitescriptdir}/%{module}-*.egg-info |
c3d23001 JR |
164 | %{_examplesdir}/%{name}-%{version} |
165 | %endif | |
166 | ||
167 | %if %{with python3} | |
168 | %files -n python3-%{module} | |
169 | %defattr(644,root,root,755) | |
4ea1c680 | 170 | %doc CHANGELOG.rst LICENSE.txt README.rst |
c3d23001 JR |
171 | %{py3_sitescriptdir}/%{module} |
172 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
173 | %{_examplesdir}/python3-%{module}-%{version} | |
174 | %endif |