]>
Commit | Line | Data |
---|---|---|
985bbc54 ER |
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 argcomplete | |
8 | %define egg_name argcomplete | |
9 | %define pypi_name argcomplete | |
10 | Summary: Bash tab completion for argparse | |
11 | Name: python-%{pypi_name} | |
12 | Version: 1.9.3 | |
13 | Release: 1 | |
14 | License: Apache v2.0 | |
15 | Group: Libraries/Python | |
16 | URL: https://github.com/kislyuk/argcomplete | |
17 | Source0: %{url}/archive/v%{version}/%{pypi_name}-%{version}.tar.gz | |
18 | # Source0-md5: 18afda95a2726eb24df810645bef4b38 | |
19 | BuildRequires: rpm-pythonprov | |
20 | BuildRequires: rpmbuild(macros) >= 1.714 | |
21 | %if %{with check} | |
22 | BuildRequires: tcsh | |
23 | %endif | |
24 | BuildArch: noarch | |
25 | ||
26 | %global _description \ | |
27 | Argcomplete provides easy, extensible command line tab completion of\ | |
28 | arguments for your Python script.\ | |
29 | \ | |
30 | It makes two assumptions: \ | |
31 | \ | |
32 | * You are using bash as your shell\ | |
33 | * You are using argparse to manage your command line arguments/options\ | |
34 | \ | |
35 | Argcomplete is particularly useful if your program has lots of\ | |
36 | options or subparsers, and if your program can dynamically suggest\ | |
37 | completions for your argument/option values (for example, if the user\ | |
38 | is browsing resources over the network). | |
39 | ||
40 | %description %{_description} | |
41 | ||
42 | %package -n python3-%{pypi_name} | |
43 | Summary: %{summary} | |
44 | Group: Libraries/Python | |
45 | BuildRequires: python3-devel | |
46 | BuildRequires: python3-setuptools | |
47 | %if %{with check} | |
48 | BuildRequires: python3-pexpect | |
49 | %endif | |
50 | # pkg_resources module is used from python-argcomplete-check-easy-install-script | |
51 | Requires: python3-setuptools | |
52 | ||
53 | %description -n python3-%{pypi_name} %{_description} | |
54 | Python 3 version. | |
55 | ||
56 | %prep | |
57 | %setup -q -n %{pypi_name}-%{version} | |
58 | ||
59 | # Remove useless BRs | |
60 | sed -i -r -e '/tests_require = /s/"(coverage|flake8|wheel)"[, ]*//g' setup.py | |
61 | ||
62 | %build | |
63 | export LC_ALL=C.UTF-8 | |
64 | %if %{with python2} | |
65 | %py_build %{?with_tests:test} | |
66 | %endif | |
67 | ||
68 | %if %{with python3} | |
69 | %py3_build %{?with_tests:test} | |
70 | %endif | |
71 | ||
72 | %install | |
73 | rm -rf $RPM_BUILD_ROOT | |
74 | %if %{with python2} | |
75 | %py_install | |
76 | %py_postclean | |
77 | %endif | |
78 | ||
79 | %if %{with python3} | |
80 | %py3_install | |
81 | %endif | |
82 | ||
83 | install -d $RPM_BUILD_ROOT%{bash_compdir} | |
84 | install -p $RPM_BUILD_ROOT%{py3_sitescriptdir}/%{pypi_name}/bash_completion.d/python-argcomplete.sh \ | |
85 | $RPM_BUILD_ROOT%{bash_compdir} | |
86 | ||
87 | %clean | |
88 | rm -rf $RPM_BUILD_ROOT | |
89 | ||
90 | %if %{with python2} | |
91 | %files | |
92 | %defattr(644,root,root,755) | |
93 | %doc README.rst LICENSE.rst | |
94 | %{py_sitescriptdir}/%{module} | |
95 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
96 | %endif | |
97 | ||
98 | %if %{with python3} | |
99 | %files -n python3-%{pypi_name} | |
100 | %defattr(644,root,root,755) | |
101 | %doc README.rst LICENSE.rst | |
102 | %attr(755,root,root) %{_bindir}/activate-global-python-argcomplete | |
103 | %attr(755,root,root) %{_bindir}/python-argcomplete-check-easy-install-script | |
104 | %attr(755,root,root) %{_bindir}/python-argcomplete-tcsh | |
105 | %attr(755,root,root) %{_bindir}/register-python-argcomplete | |
106 | %{py3_sitescriptdir}/%{module} | |
107 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
108 | %{bash_compdir}/python-argcomplete.sh | |
109 | %endif |