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