Blob Blame History Raw
%global pypi_name tosca-parser

%if 0%{?fedora}
%global with_python3 1
%endif

Name:           python-%{pypi_name}
Version:        0.8.1
Release:        3%{?dist}
Summary:        Parser for TOSCA Simple Profile in YAML

License:        ASL 2.0
URL:            https://github.com/openstack/tosca-parser
Source0:        https://pypi.io/packages/source/t/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

%description
The TOSCA Parser is an OpenStack project and licensed under Apache 2. 
It is developed to parse TOSCA Simple Profile in YAML. It reads the TOSCA
templates and creates an in-memory graph of TOSCA nodes and their relationship.

%package -n python2-%{pypi_name}
Summary:        Parser for TOSCA Simple Profile in YAML
%{?python_provide:%python_provide python2-%{pypi_name}}

BuildRequires:  python2-devel
BuildRequires:  python2-pbr >= 1.3
BuildRequires:  python2-sphinx
BuildRequires:  python2-oslo-sphinx
BuildRequires:  python2-babel
BuildRequires:  python2-pyyaml
BuildRequires:  python2-setuptools
# Required for testing
BuildRequires:  python2-six
BuildRequires:  python2-dateutil
BuildRequires:  python2-cliff
BuildRequires:  python2-fixtures
BuildRequires:  python2-hacking
BuildRequires:  python2-testrepository
BuildRequires:  python2-testtools
BuildRequires:  python2-testscenarios
BuildRequires:  python2-oslotest
BuildRequires:  python2-subunit

Requires:       python2-pyyaml
Requires:       python2-cliff
Requires:       python2-dateutil
Requires:       python2-requests
Requires:       python2-six

%description -n python2-%{pypi_name}
The TOSCA Parser is an OpenStack project and licensed under Apache 2. 
It is developed to parse TOSCA Simple Profile in YAML. It reads the TOSCA
templates and creates an in-memory graph of TOSCA nodes and their relationship.

%package -n python2-%{pypi_name}-doc
Summary:        Parser for TOSCA Simple Profile in YAML - documentation
%{?python_provide:%python_provide python2-%{pypi_name}-doc}

BuildRequires:  python2-sphinx
BuildRequires:  python2-oslo-sphinx

Requires:       python2-%{pypi_name} = %{version}-%{release}

%description -n python2-%{pypi_name}-doc
The TOSCA Parser is an OpenStack project and licensed under Apache 2. 
This package contains its documentation

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        Parser for TOSCA Simple Profile in YAML
%{?python_provide:%python_provide python3-%{pypi_name}}

BuildRequires:  python3-devel
BuildRequires:  python3-pbr >= 1.3
BuildRequires:  python3-sphinx
BuildRequires:  python3-oslo-sphinx
BuildRequires:  python3-babel
BuildRequires:  python3-PyYAML
BuildRequires:  python3-setuptools
# Required for testing
BuildRequires:  python3-six
BuildRequires:  python3-dateutil
BuildRequires:  python3-cliff
BuildRequires:  python3-fixtures
BuildRequires:  python3-hacking
BuildRequires:  python3-testrepository
BuildRequires:  python3-testtools
BuildRequires:  python3-testscenarios
BuildRequires:  python3-oslotest
BuildRequires:  python3-subunit

Requires:       python3-PyYAML
Requires:       python3-cliff
Requires:       python3-dateutil
Requires:       python3-requests
Requires:       python3-six

%description -n python3-%{pypi_name}
The TOSCA Parser is an OpenStack project and licensed under Apache 2. 
It is developed to parse TOSCA Simple Profile in YAML. It reads the TOSCA
templates and creates an in-memory graph of TOSCA nodes and their relationship.


%package -n python3-%{pypi_name}-doc
Summary:        Parser for TOSCA Simple Profile in YAML - documentation
%{?python_provide:%python_provide python3-%{pypi_name}-doc}

BuildRequires:  python3-sphinx
BuildRequires:  python3-oslo-sphinx

Requires:       python3-%{pypi_name} = %{version}-%{release}

%description -n python3-%{pypi_name}-doc
The TOSCA Parser is an OpenStack project and licensed under Apache 2. 
This package contains its documentation
%endif


%prep
%setup -q -n %{pypi_name}-%{version}

%build
%{__python2} setup.py build

%if 0%{?with_python3}
%{__python3} setup.py build
%endif

%check
%if 0%{?with_python3}
# Cleanup test repository
%{__python3} setup.py test || :
rm -rf .testrepository
%endif

# Ignore test results for now, they are trying to access a URL in GitHub,
# which is not accessible in Koji
%{__python2} setup.py test || : 

%install
%if 0%{?with_python3}
%{py3_install}
sphinx-build-3 doc/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
# Set executable permission on test scripts
find %{buildroot}/%{python3_sitelib}/toscaparser/tests -name '*.sh' -execdir chmod +x '{}' \;
# Fix shebang on some test scripts
find %{buildroot}/%{python3_sitelib}/toscaparser/tests -name '*.py' -execdir sed -i -e 's%^#!/usr/bin/python%#!/usr/bin/python3%' '{}' \;
mv %{buildroot}%{_bindir}/tosca-parser %{buildroot}%{_bindir}/tosca-parser-%{python3_version}
ln -s ./tosca-parser-%{python3_version} %{buildroot}%{_bindir}/tosca-parser-3
%endif

%{py2_install}
# generate html docs 
sphinx-build doc/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
# Set executable permission on test scripts
find %{buildroot}/%{python2_sitelib}/toscaparser/tests -name '*.sh' -execdir chmod +x '{}' \;
mv %{buildroot}%{_bindir}/tosca-parser %{buildroot}%{_bindir}/tosca-parser-%{python2_version}
ln -s ./tosca-parser-%{python2_version} %{buildroot}%{_bindir}/tosca-parser-2
ln -s ./tosca-parser-2 %{buildroot}%{_bindir}/tosca-parser

%files -n python2-%{pypi_name}
%doc README.rst
%license LICENSE
%{_bindir}/tosca-parser
%{_bindir}/tosca-parser-2
%{_bindir}/tosca-parser-%{python2_version}
%{python2_sitelib}/toscaparser
%{python2_sitelib}/tosca_parser-%{version}-py?.?.egg-info

%files -n python2-%{pypi_name}-doc
%doc html README.rst
%license LICENSE

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst
%license LICENSE
%{_bindir}/tosca-parser-3
%{_bindir}/tosca-parser-%{python3_version}
%{python3_sitelib}/toscaparser
%{python3_sitelib}/tosca_parser-%{version}-py?.?.egg-info

%files -n python3-%{pypi_name}-doc
%doc html README.rst
%license LICENSE
%endif

%changelog
* Fri Feb 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.8.1-3
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.8.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Mon Aug 14 2017 Javier Peña <jpena@redhat.com> - 0.8.1-1
- Updated to upstream release 0.8.1

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

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

* Mon Jan 23 2017 Javier Peña <jpena@redhat.com> - 0.7.0-1
- Updated to upstream release 0.7.0

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

* Wed Nov 02 2016 Javier Peña <jpena@redhat.com> - 0.6.0-3
- Fix shebang for certain test scripts in python3 subpackage, so python2 is not included (bz#1390505)
- Invert test execution, so python3 tests are executed
- Use pypi.io for Source0 URL

* Tue Aug 16 2016 Javier Peña <jpena@redhat.com> - 0.6.0-2
- Ignore test results, they're trying to access the Internet

* Tue Aug 16 2016 Javier Peña <jpena@redhat.com> - 0.6.0-1
- Updated to upstream version 0.6.0

* Wed Sep 09 2015 jpena <jpena@redhat.com> - 0.1.0-3
- Fix file permissions for test scripts

* Wed Sep 09 2015 jpena <jpena@redhat.com> - 0.1.0-2
- Created docs subpackages
- Added tests
- Fixes for python3 subpkg

* Tue Sep 08 2015 jpena <jpena@redhat.com> - 0.1.0-1
- Initial package.