]>
Commit | Line | Data |
---|---|---|
4142ef01 JK |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with doc # build doc (broken) | |
4 | %bcond_with tests # do perform "make test" (broken) | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | Summary: cmd2 - a tool for building interactive command line applications in Python | |
9 | Name: python-cmd2 | |
10 | Version: 0.7.5 | |
4d591c75 | 11 | Release: 8 |
4142ef01 JK |
12 | License: MIT |
13 | Group: Libraries/Python | |
14 | Source0: https://pypi.python.org/packages/99/18/0bfe8240ffaebd28b1bce5a48170404e32bc1de6e640c8e7f37f1e522edb/cmd2-%{version}.tar.gz | |
15 | # Source0-md5: 9f758f3a6a20f1220d60f6320bb839b3 | |
16 | URL: https://pypi.python.org/pypi/cmd2 | |
17 | BuildRequires: rpm-pythonprov | |
18 | BuildRequires: rpmbuild(macros) >= 1.714 | |
19 | %if %{with python2} | |
20 | BuildRequires: python-setuptools | |
21 | %if %{with tests} | |
22 | BuildRequires: python-mock | |
23 | BuildRequires: python-pyparsing >= 2.0.1 | |
24 | BuildRequires: python-pyperclip | |
25 | BuildRequires: python-pytest | |
26 | BuildRequires: python-six | |
27 | %endif | |
28 | %endif | |
29 | %if %{with python3} | |
30 | BuildRequires: python3-setuptools | |
31 | %if %{with tests} | |
32 | BuildRequires: python3-mock | |
33 | BuildRequires: python3-pyparsing >= 2.0.1 | |
34 | BuildRequires: python3-pyperclip | |
35 | BuildRequires: python3-pytest | |
36 | BuildRequires: python3-six | |
37 | %endif | |
38 | %if %{with doc} | |
39 | BuildRequires: python3-sphinx_rtd_theme | |
40 | BuildRequires: sphinx-pdg-3 | |
41 | %endif | |
42 | %endif | |
43 | Requires: python3-pyparsing >= 2.0.1 | |
44 | Requires: python3-pyperclip | |
45 | Requires: python3-six | |
46 | BuildArch: noarch | |
47 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
48 | ||
49 | %description | |
50 | cmd2 is a tool for building interactive command line applications in | |
51 | Python. Its goal is to make it quick and easy for developers to build | |
52 | feature-rich and user-friendly interactive command line applications. | |
53 | It provides a simple API which is an extension of Python's built-in | |
54 | cmd module. cmd2 provides a wealth of features on top of cmd to make | |
55 | your life easier and eliminates much of the boilerplate code which | |
56 | would be necessary when using cmd. | |
57 | ||
58 | %package -n python3-cmd2 | |
59 | Summary: cmd2 - a tool for building interactive command line applications in Python | |
60 | Group: Libraries/Python | |
61 | Requires: python3-modules | |
62 | ||
63 | %description -n python3-cmd2 | |
64 | cmd2 is a tool for building interactive command line applications in | |
65 | Python. Its goal is to make it quick and easy for developers to build | |
66 | feature-rich and user-friendly interactive command line applications. | |
67 | It provides a simple API which is an extension of Python's built-in | |
68 | cmd module. cmd2 provides a wealth of features on top of cmd to make | |
69 | your life easier and eliminates much of the boilerplate code which | |
70 | would be necessary when using cmd. | |
71 | ||
72 | %package apidocs | |
73 | Summary: API documentation for Python cmd2 module | |
74 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona cmd2 | |
75 | Group: Documentation | |
76 | ||
77 | %description apidocs | |
78 | API documentation for Pythona cmd2 module. | |
79 | ||
80 | %description apidocs -l pl.UTF-8 | |
81 | Dokumentacja API modułu Pythona cmd2. | |
82 | ||
83 | %prep | |
84 | %setup -q -n cmd2-%{version} | |
85 | ||
86 | %build | |
87 | %if %{with python2} | |
88 | %py_build %{?with_tests:pytest} | |
89 | %endif | |
90 | ||
91 | %if %{with python3} | |
92 | %py3_build %{?with_tests:pytest} | |
93 | ||
94 | %if %{with doc} | |
95 | %{__python3} setup.py build_sphinx | |
96 | %endif | |
97 | %endif | |
98 | ||
99 | %install | |
100 | rm -rf $RPM_BUILD_ROOT | |
101 | ||
102 | %if %{with python2} | |
103 | %py_install | |
104 | ||
105 | %py_postclean | |
106 | %endif | |
107 | ||
108 | %if %{with python3} | |
109 | %py3_install | |
110 | %endif | |
111 | ||
112 | # in case there are examples provided | |
113 | %if %{with python2} | |
114 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python-cmd2-%{version} | |
115 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python-cmd2-%{version} | |
116 | find $RPM_BUILD_ROOT%{_examplesdir}/python-cmd2-%{version} -name '*.py' \ | |
117 | | xargs sed -i '1s|^#!.*python\b|#!%{__python}|' | |
118 | %endif | |
119 | %if %{with python3} | |
120 | install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-cmd2-%{version} | |
121 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-cmd2-%{version} | |
122 | find $RPM_BUILD_ROOT%{_examplesdir}/python3-cmd2-%{version} -name '*.py' \ | |
123 | | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|' | |
124 | %endif | |
125 | ||
126 | %clean | |
127 | rm -rf $RPM_BUILD_ROOT | |
128 | ||
129 | %if %{with python2} | |
130 | %files | |
131 | %defattr(644,root,root,755) | |
132 | %doc CHANGES.md README.md | |
133 | %{py_sitescriptdir}/cmd2.py* | |
134 | %{py_sitescriptdir}/cmd2-%{version}-py*.egg-info | |
135 | %{_examplesdir}/python-cmd2-%{version} | |
136 | %endif | |
137 | ||
138 | %if %{with python3} | |
139 | %files -n python3-cmd2 | |
140 | %defattr(644,root,root,755) | |
141 | %doc CHANGES.md README.md | |
142 | %{py3_sitescriptdir}/cmd2.py | |
143 | %{py3_sitescriptdir}/__pycache__/* | |
144 | %{py3_sitescriptdir}/cmd2-%{version}-py*.egg-info | |
145 | %{_examplesdir}/python3-cmd2-%{version} | |
146 | %endif | |
147 | ||
148 | %if %{with doc} | |
149 | %files apidocs | |
150 | %defattr(644,root,root,755) | |
151 | %doc docs/_build/html/* | |
152 | %endif |