]>
Commit | Line | Data |
---|---|---|
c3d23001 JR |
1 | # |
2 | # Conditional build: | |
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 | |
6 | ||
7 | %define module colorama | |
8 | Summary: Cross-platform colored terminal text | |
9 | Name: python-%{module} | |
10 | Version: 0.3.1 | |
44aa29e6 | 11 | Release: 5 |
c3d23001 JR |
12 | License: BSD |
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 | |
19 | %if %{with python2} | |
20 | BuildRequires: python-distribute | |
21 | %endif | |
22 | %if %{with python3} | |
23 | BuildRequires: python3-distribute | |
24 | BuildRequires: python3-modules | |
25 | %endif | |
26 | Requires: python-modules | |
27 | BuildArch: noarch | |
28 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
29 | ||
30 | %description | |
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 | |
37 | nothing. | |
38 | ||
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.) | |
42 | ||
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(). | |
48 | ||
49 | %package -n python3-%{module} | |
50 | Summary: Cross-platform colored terminal text | |
51 | Group: Libraries/Python | |
52 | ||
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 | |
60 | nothing. | |
61 | ||
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.) | |
65 | ||
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(). | |
71 | ||
72 | %prep | |
73 | %setup -q -n %{module}-%{version} | |
74 | ||
75 | %build | |
76 | %if %{with python2} | |
77 | %{__python} setup.py build --build-base build-2 %{?with_tests:test} | |
78 | %endif | |
79 | ||
80 | %if %{with python3} | |
81 | %{__python3} setup.py build --build-base build-3 %{?with_tests:test} | |
82 | %endif | |
83 | ||
84 | %install | |
85 | rm -rf $RPM_BUILD_ROOT | |
86 | ||
87 | %if %{with python2} | |
88 | %{__python} setup.py \ | |
89 | build --build-base build-2 \ | |
90 | install --skip-build \ | |
91 | --optimize=2 \ | |
92 | --root=$RPM_BUILD_ROOT | |
93 | ||
94 | %py_postclean | |
95 | %endif | |
96 | ||
97 | %if %{with python3} | |
98 | %{__python3} setup.py \ | |
99 | build --build-base build-3 \ | |
100 | install --skip-build \ | |
101 | --optimize=2 \ | |
102 | --root=$RPM_BUILD_ROOT | |
103 | %endif | |
104 | ||
105 | %if %{with python2} | |
106 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
107 | cp -a demos/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
108 | %endif | |
109 | %if %{with python3} | |
110 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
111 | cp -a demos/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} | |
112 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \ | |
113 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
114 | %endif | |
115 | ||
116 | %clean | |
117 | rm -rf $RPM_BUILD_ROOT | |
118 | ||
119 | %if %{with python2} | |
120 | %files | |
121 | %defattr(644,root,root,755) | |
122 | %doc CHANGELOG.rst README.txt | |
52c7cb20 | 123 | %dir %{py_sitescriptdir}/%{module} |
c3d23001 JR |
124 | %{py_sitescriptdir}/%{module}/*.py[co] |
125 | %if "%{py_ver}" > "2.4" | |
126 | %{py_sitescriptdir}/%{module}-*.egg-info | |
127 | %endif | |
128 | %{_examplesdir}/%{name}-%{version} | |
129 | %endif | |
130 | ||
131 | %if %{with python3} | |
132 | %files -n python3-%{module} | |
133 | %defattr(644,root,root,755) | |
134 | %doc CHANGELOG.rst README.txt | |
135 | %{py3_sitescriptdir}/%{module} | |
136 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
137 | %{_examplesdir}/python3-%{module}-%{version} | |
138 | %endif |