Alexei Sorokin 2018-11-19 15:58:16 +00:00 committed by Git OBS Bridge
parent 5086eae4dc
commit e61d53f8eb

View File

@ -24,7 +24,7 @@ License: GPL-3.0-or-later
Group: System/Console
URL: https://github.com/wting/autojump
Source: https://github.com/wting/autojump/archive/release-v%{version}.tar.gz#/%{name}-%{version}.tar.gz
BuildRequires: python3-devel
BuildRequires: python3
BuildRequires: python3-mock
BuildRequires: python3-pytest
BuildArch: noarch
@ -38,8 +38,10 @@ Directories must be visited first before they can be jumped to.
%prep
%setup -q -n %{name}-release-v%{version}
# Fix shebangs.
sed -i 's/env python$/python3/' bin/%{name}
sed -i '/env python$/s|^.*$|# -*- python -*-|' bin/%{name}_*.py
sed -i '/env python$/s/^.*$/# -*- python -*-/' bin/%{name}_*.py
%build
# Nothing to build.
@ -59,16 +61,16 @@ rm %{buildroot}%{_bindir}/%{name}_argparse.py
sed -i 's/autojump_argparse/argparse/' %{buildroot}%{_bindir}/%{name}*
# Make it a proper Python module instead of polluting bindir.
sed -Ei "s/^(import|from) %{name}_(data|match|utils)/\1 %{name}.\2/" \
%{buildroot}%{_bindir}/%{name} %{buildroot}%{_bindir}/%{name}_*.py
mkdir -p %{buildroot}%{python3_sitelib}/%{name}/
echo "# -*- python -*-" > %{buildroot}%{python3_sitelib}/%{name}/__init__.py
for m in data match utils; do
mv "%{buildroot}%{_bindir}/%{name}_$m.py" \
"%{buildroot}%{python3_sitelib}/%{name}/$m.py"
done
for m in data match utils; do
sed -i "s/^from %{name}_$m import/from %{name}.$m import/" \
%{buildroot}%{_bindir}/%{name} %{buildroot}%{python3_sitelib}/%{name}/*.py
done
echo "# -*- python -*-" > %{buildroot}%{python3_sitelib}/%{name}/__init__.py
%py3_compile %{buildroot}%{python3_sitelib}/%{name}/
%check