3 %bcond_without tests # do not perform "make test"
4 %bcond_without python2 # CPython 2.x module
5 %bcond_without python3 # CPython 3.x module
7 %define module colorama
8 Summary: Cross-platform colored terminal text
13 Group: Libraries/Python
14 Source0: https://pypi.python.org/packages/source/c/colorama/%{module}-%{version}.tar.gz
15 # Source0-md5: 95ce8bf32f5c25adea14b809db3509cb
16 URL: https://pypi.python.org/pypi/colorama
17 BuildRequires: rpm-pythonprov
18 BuildRequires: rpmbuild(macros) >= 1.219
20 BuildRequires: python-distribute
23 BuildRequires: python3-distribute
24 BuildRequires: python3-modules
26 Requires: python-modules
28 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
31 ANSI escape character sequences have long been used to produce colored
32 terminal text and cursor positioning on Unix and Macs. Colorama makes
33 this work on Windows, too, by wrapping stdout, stripping ANSI
34 sequences it finds (which otherwise show up as gobbledygook in your
35 output), and converting them into the appropriate win32 calls to
36 modify the state of the terminal. On other platforms, Colorama does
39 Colorama also provides some shortcuts to help generate ANSI sequences
40 but works fine in conjunction with any other ANSI sequence generation
41 library, such as Termcolor (http://pypi.python.org/pypi/termcolor.)
43 This has the upshot of providing a simple cross-platform API for
44 printing colored terminal text from Python, and has the happy
45 side-effect that existing applications or libraries which use ANSI
46 sequences to produce colored output on Linux or Macs can now also
47 work on Windows, simply by calling colorama.init().
49 %package -n python3-%{module}
50 Summary: Cross-platform colored terminal text
51 Group: Libraries/Python
53 %description -n python3-%{module}
54 ANSI escape character sequences have long been used to produce colored
55 terminal text and cursor positioning on Unix and Macs. Colorama makes
56 this work on Windows, too, by wrapping stdout, stripping ANSI
57 sequences it finds (which otherwise show up as gobbledygook in your
58 output), and converting them into the appropriate win32 calls to
59 modify the state of the terminal. On other platforms, Colorama does
62 Colorama also provides some shortcuts to help generate ANSI sequences
63 but works fine in conjunction with any other ANSI sequence generation
64 library, such as Termcolor (http://pypi.python.org/pypi/termcolor.)
66 This has the upshot of providing a simple cross-platform API for
67 printing colored terminal text from Python, and has the happy
68 side-effect that existing applications or libraries which use ANSI
69 sequences to produce colored output on Linux or Macs can now also
70 work on Windows, simply by calling colorama.init().
73 %setup -q -n %{module}-%{version}
77 %py_build %{?with_tests:test}
81 %py3_build %{?with_tests:test}
85 rm -rf $RPM_BUILD_ROOT
98 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
99 cp -a demos/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
102 install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
103 cp -a demos/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
104 find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
105 | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
109 rm -rf $RPM_BUILD_ROOT
113 %defattr(644,root,root,755)
114 %doc CHANGELOG.rst README.txt
115 %dir %{py_sitescriptdir}/%{module}
116 %{py_sitescriptdir}/%{module}/*.py[co]
117 %if "%{py_ver}" > "2.4"
118 %{py_sitescriptdir}/%{module}-*.egg-info
120 %{_examplesdir}/%{name}-%{version}
124 %files -n python3-%{module}
125 %defattr(644,root,root,755)
126 %doc CHANGELOG.rst README.txt
127 %{py3_sitescriptdir}/%{module}
128 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
129 %{_examplesdir}/python3-%{module}-%{version}