a00bcfe
%if 0%{?rhel} && 0%{?rhel} <= 6
a00bcfe
%{!?__python2: %global __python2 /usr/bin/python2}
a00bcfe
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
a00bcfe
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
a00bcfe
%endif
a00bcfe
a00bcfe
%if (0%{?fedora} >= 21 || 0%{?rhel} >= 8)
a00bcfe
%global with_python3 1
a00bcfe
%endif
a00bcfe
a00bcfe
%global owner DBuildService
a00bcfe
%global project dockerfile-parse
a00bcfe
a00bcfe
%global commit 2fee7d3622dc484034c6f115f08fd5e9ec78c011
a00bcfe
%global shortcommit %(c=%{commit}; echo ${c:0:7})
a00bcfe
a00bcfe
Name:           python-dockerfile-parse
a00bcfe
Version:        0.0.3
a00bcfe
Release:        2%{?dist}
a00bcfe
a00bcfe
Summary:        Python library for Dockerfile manipulation
a00bcfe
Group:          Development/Tools
a00bcfe
License:        BSD
a00bcfe
URL:            https://github.com/%{owner}/%{project}
a00bcfe
Source0:        https://github.com/%{owner}/%{project}/archive/%{commit}/%{project}-%{commit}.tar.gz
a00bcfe
a00bcfe
BuildArch:      noarch
a00bcfe
a00bcfe
BuildRequires:  python2-devel
a00bcfe
BuildRequires:  python-setuptools
a00bcfe
Requires:       python-setuptools
a00bcfe
a00bcfe
%if 0%{?with_python3}
a00bcfe
BuildRequires:  python3-devel
a00bcfe
BuildRequires:  python3-setuptools
a00bcfe
%endif
a00bcfe
a00bcfe
%description
a00bcfe
Python library for Dockerfile manipulation
a00bcfe
a00bcfe
%if 0%{?with_python3}
a00bcfe
%package -n python3-%{project}
a00bcfe
Summary:        Python 3 library for Dockerfile manipulation
a00bcfe
Group:          Development/Tools
a00bcfe
License:        BSD
a00bcfe
Requires:       python3-setuptools
a00bcfe
a00bcfe
%description -n python3-%{project}
a00bcfe
Python 3 library for Dockerfile manipulation
a00bcfe
%endif # with_python3
a00bcfe
a00bcfe
%prep
a00bcfe
%setup -qn %{project}-%{commit}
a00bcfe
%if 0%{?with_python3}
a00bcfe
rm -rf %{py3dir}
a00bcfe
cp -a . %{py3dir}
a00bcfe
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
a00bcfe
%endif # with_python3
a00bcfe
a00bcfe
a00bcfe
%build
a00bcfe
# build python package
a00bcfe
%{__python} setup.py build
a00bcfe
%if 0%{?with_python3}
a00bcfe
pushd %{py3dir}
a00bcfe
%{__python3} setup.py build
a00bcfe
popd
a00bcfe
%endif # with_python3
a00bcfe
a00bcfe
a00bcfe
%install
a00bcfe
%if 0%{?with_python3}
a00bcfe
pushd %{py3dir}
a00bcfe
%{__python3} setup.py install --skip-build --root %{buildroot}
a00bcfe
popd
a00bcfe
%endif # with_python3
a00bcfe
a00bcfe
%{__python} setup.py install --skip-build --root %{buildroot}
a00bcfe
a00bcfe
a00bcfe
%files
a00bcfe
%doc README.md
a00bcfe
%{!?_licensedir:%global license %%doc}
a00bcfe
%license LICENSE
a00bcfe
%dir %{python2_sitelib}/dockerfile_parse
a00bcfe
%{python2_sitelib}/dockerfile_parse/*.*
a00bcfe
%{python2_sitelib}/dockerfile_parse-%{version}-py2.*.egg-info
a00bcfe
a00bcfe
%if 0%{?with_python3}
a00bcfe
%files -n python3-%{project}
a00bcfe
%doc README.md
a00bcfe
%{!?_licensedir:%global license %%doc}
a00bcfe
%license LICENSE
a00bcfe
%dir %{python3_sitelib}/dockerfile_parse
a00bcfe
%dir %{python3_sitelib}/dockerfile_parse/__pycache__
a00bcfe
%{python3_sitelib}/dockerfile_parse/*.*
a00bcfe
%{python3_sitelib}/dockerfile_parse/__pycache__/*.py*
a00bcfe
%{python3_sitelib}/dockerfile_parse-%{version}-py3.*.egg-info
a00bcfe
%endif # with_python3
a00bcfe
a00bcfe
%changelog
a00bcfe
* Tue Jun 30 2015 Jiri Popelka <jpopelka@redhat.com> - 0.0.3-2
a00bcfe
- define macros for RHEL-6
a00bcfe
a00bcfe
* Fri Jun 26 2015 Jiri Popelka <jpopelka@redhat.com> - 0.0.3-1
a00bcfe
- 0.0.3
a00bcfe
a00bcfe
* Fri Jun 26 2015 Jiri Popelka <jpopelka@redhat.com> - 0.0.2-1
a00bcfe
- 0.0.2
a00bcfe
a00bcfe
* Thu Jun 18 2015 Jiri Popelka <jpopelka@redhat.com> - 0.0.1-1
a00bcfe
- initial release