Blob Blame History Raw
%global srcname aexpect
%global pkgname aexpect

# Conditional for release vs. snapshot builds. Set to 1 for release build.
%if ! 0%{?rel_build:1}
    %global rel_build 1
%endif

# Settings used for build from snapshots.
%if 0%{?rel_build}
    %global gittar              %{srcname}-%{version}.tar.gz
%else
    %if ! 0%{?commit:1}
        %global commit          ca7f21d31ee4b580fd72a32d494b7dabc728fbf5
    %endif
    %if ! 0%{?commit_date:1}
        %global commit_date     20180613
    %endif
    %global shortcommit         %(c=%{commit};echo ${c:0:8})
    %global gitrel              .%{commit_date}git%{shortcommit}
    %global gittar              %{srcname}-%{shortcommit}.tar.gz
%endif

# Selftests are provided but skipped because they use unsupported tooling.
%global with_tests 0

%bcond_without python2
%if 0%{?fedora} || 0%{?rhel} > 7
    %bcond_without python3
%else
    %bcond_with    python3
%endif

Name: python-%{pkgname}
Version: 1.5.1
Release: 4%{?gitrel}%{?dist}
Summary: A python library to control interactive applications

License: GPLv2
URL: https://github.com/avocado-framework/aexpect

%if 0%{?rel_build}
Source0: https://github.com/avocado-framework/%{srcname}/archive/%{version}.tar.gz#/%{gittar}
%else
Source0: https://github.com/avocado-framework/%{srcname}/archive/%{commit}.tar.gz#/%{gittar}
%endif

BuildArch: noarch

%if %{with python2}
Requires: python2
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%endif

%if %{with python3}
Requires: python3
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif


%description
Aexpect is a python library used to control interactive applications, very
similar to pexpect. You can use it to control applications such as ssh, scp
sftp, telnet, among others.

%if %{with python2}
%package -n python2-%{pkgname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pkgname}}
%if 0%{?fedora} > 27 || 0%{?rhel} > 7
Requires: python2-subprocess32
%else
Requires: python-subprocess32
%endif

%description -n python2-%{pkgname}
Aexpect is a python library used to control interactive applications, very
similar to pexpect. You can use it to control applications such as ssh, scp
sftp, telnet, among others.
%endif

%if %{with python3}
%package -n python%{python3_pkgversion}-%{pkgname}
Summary: %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pkgname}}

%description -n python%{python3_pkgversion}-%{pkgname}
Aexpect is a python library used to control interactive applications, very
similar to pexpect. You can use it to control applications such as ssh, scp
sftp, telnet, among others.
%endif


%prep
%if 0%{?rel_build}
%autosetup -n %{srcname}-%{version}
%else
%autosetup -n %{srcname}-%{commit}
%endif

%build
%if %{with python2}
%py2_build
%endif

%if %{with python3}
%py3_build
%endif

%install
# Note: library uses python-specific version of helper script, so no unversioned link created
%if %{with python2}
%py2_install
# move and symlink python2 version-specific executables
mv %{buildroot}%{_bindir}/aexpect-helper %{buildroot}%{_bindir}/aexpect-helper-%{python2_version}
ln -s aexpect-helper-%{python2_version} %{buildroot}%{_bindir}/aexpect-helper-2
%endif

%if %{with python3}
%py3_install
# move and symlink python3 version-specific executables
mv %{buildroot}%{_bindir}/aexpect-helper %{buildroot}%{_bindir}/aexpect-helper-%{python3_version}
ln -s aexpect-helper-%{python3_version} %{buildroot}%{_bindir}/aexpect-helper-3
%endif


%check
%if %{with_tests}
selftests/checkall
%endif

%if %{with python2}
%files -n python2-%{pkgname}
%license LICENSE
%doc README.rst
%{python2_sitelib}/aexpect/
%{python2_sitelib}/aexpect-%{version}-py%{python2_version}.egg-info
%{_bindir}/aexpect-helper-2*
%endif

%if %{with python3}
%files -n python%{python3_pkgversion}-%{pkgname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/aexpect/
%{python3_sitelib}/aexpect-%{version}-py%{python3_version}.egg-info
%{_bindir}/aexpect-helper-3*
%endif

%changelog
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.5.1-2
- Rebuilt for Python 3.7

* Wed Jun 13 2018 Merlin Mathesius <mmathesi@redhat.com> - 1.5.1-1
- Sync with upstream release 1.5.1 (BZ#1588660).
- Now with full python3 support (BZ#1437184).

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Tue Apr 04 2017 Merlin Mathesius <mmathesi@redhat.com> - 1.4.0-1
- Sync with upstream release 1.4.0 (BZ#1438782).
- Update source location to refer to new home.
- Provide python2 version-specific executables.

* Mon Feb 20 2017 Merlin Mathesius <mmathesi@redhat.com> - 1.3.1-1
- Sync with upstream release 1.3.1 (BZ#1425027).

* Tue Feb 14 2017 Merlin Mathesius <mmathesi@redhat.com> - 1.3.0-1
- Sync with upstream release 1.3.0.
- SPEC updates to easily switch between release and snapshot builds.

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-6.20161110gitaca459d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Tue Jan 10 2017 Merlin Mathesius <mmathesi@redhat.com> - 1.2.0-5
- SPEC updates to build and install for EPEL.

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.2.0-4.20161110gitaca459d
- Rebuild for Python 3.6

* Thu Nov 10 2016 Merlin Mathesius <mmathesi@redhat.com> - 1.2.0-3
- Initial packaging for Fedora.