From 2ee320e52094646e91180623e0dff64d6890643a Mon Sep 17 00:00:00 2001 From: Matthias Runge Date: Oct 12 2016 08:17:57 +0000 Subject: Provide python3 package Resolves: rhbz#1365046 --- diff --git a/python-XStatic-D3.spec b/python-XStatic-D3.spec index 7e940c8..ab8a72e 100644 --- a/python-XStatic-D3.spec +++ b/python-XStatic-D3.spec @@ -1,66 +1,134 @@ +%if 0%{?fedora} +%global with_python3 1 +%endif + %global pypi_name XStatic-D3 Name: python-%{pypi_name} Version: 3.1.6.2 -Release: 5%{?dist} +Release: 6%{?dist} Summary: D3 (XStatic packaging standard) License: BSD URL: http://d3js.org/ -Source0: https://pypi.python.org/packages/source/X/%{pypi_name}/%{pypi_name}-%{version}.tar.gz +Source0: https://files.pythonhosted.org/packages/source/X/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch - + +%description +JavaScript library packaged for setuptools (easy_install) / pip. + +This package is intended to be used by any project that needs these files. + +It intentionally does not provide any extra code except some metadata +nor has any extra requirements. + +%package -n python2-%{pypi_name} +Summary: %{summary} + BuildRequires: python2-devel -BuildRequires: python-setuptools -BuildRequires: web-assets-devel +BuildRequires: python2-setuptools -Requires: python-XStatic -Requires: web-assets-filesystem +Requires: python2-XStatic +Requires: xstatic-d3-common +%{?python_provide:%python_provide python2-%{pypi_name}} -%description -D3 JavaScript library packaged for setuptools -(easy_install) / pip. +%description -n python2-%{pypi_name} +JavaScript library packaged for setuptools (easy_install) / pip. -This package is intended to be used by **any** project -that needs these files. +This package is intended to be used by any project that needs these files. -It intentionally does **not** provide any extra code -except some metadata +It intentionally does not provide any extra code except some metadata +nor has any extra requirements. -%prep -%setup -q -n %{pypi_name}-%{version} -# Remove bundled egg-info -rm -rf %{pypi_name}.egg-info +This package provides Python 2 build of %{pypi_name}. -# patch to use webassets dir -sed -i "s|^BASE_DIR = .*|BASE_DIR = '%{_jsdir}/d3'|" xstatic/pkg/d3/__init__.py +%if 0%{?with_python3} +%package -n python3-%{pypi_name} +Summary: %{summary} +BuildRequires: python3-devel +BuildRequires: python3-setuptools -%build -# due -# https://bitbucket.org/thomaswaldmann/xstatic/issue/2/ -# this package can not be built with python-XStatic installed. -%{__python2} setup.py build +Requires: python3-XStatic +Requires: xstatic-d3-common +%{?python_provide:%python_provide python3-%{pypi_name}} +%description -n python3-%{pypi_name} +JavaScript library packaged for setuptools (easy_install) / pip. -%install -%{__python2} setup.py install --skip-build --root %{buildroot} -mkdir -p %{buildroot}/%{_jsdir}/d3 -mv %{buildroot}/%{python2_sitelib}/xstatic/pkg/d3/data/d3.js %{buildroot}/%{_jsdir}/d3 +This package is intended to be used by any project that needs these files. + +It intentionally does not provide any extra code except some metadata +nor has any extra requirements. + +This package provides Python 3 build of %{pypi_name}. +%endif +%package -n xstatic-d3-common +Summary: %{summary} +BuildRequires: web-assets-devel +Requires: web-assets-filesystem + +%description -n xstatic-d3-common +JavaScript library packaged for setuptools (easy_install) / pip. + +This package is intended to be used by any project that needs these files. + +It intentionally does not provide any extra code except some metadata +nor has any extra requirements. + +This package contains the javascript files. + +%prep +%autosetup -n %{pypi_name}-%{version} +# patch to use webassets dir +sed -i "s|^BASE_DIR = .*|BASE_DIR = '%{_jsdir}/d3'|" xstatic/pkg/d3/__init__.py +%build +%py2_build +%if 0%{?with_python3} +%py3_build +%endif -%files +%install +%py2_install +mkdir -p %{buildroot}%{_jsdir}/d3 +mv %{buildroot}%{python2_sitelib}/xstatic/pkg/d3/data/d3.js %{buildroot}%{_jsdir}/d3 +rmdir %{buildroot}%{python2_sitelib}/xstatic/pkg/d3/data/ +# fix execute flags for js +chmod 644 %{buildroot}%{_jsdir}/d3/d3.js + +%if 0%{?with_python3} +%py3_install +# Remove static files, already created by the python2 subpkg +rm -rf %{buildroot}%{python3_sitelib}/xstatic/pkg/d3/data +%endif + +%files -n python2-%{pypi_name} %doc README.txt %{python2_sitelib}/xstatic/pkg/d3 -%{python2_sitelib}/XStatic_D3-%{version}-py%{python_version}.egg-info -%{python2_sitelib}/XStatic_D3-%{version}-py%{python_version}-nspkg.pth +%{python2_sitelib}/XStatic_D3-%{version}-py%{python2_version}.egg-info +%{python2_sitelib}/XStatic_D3-%{version}-py%{python2_version}-nspkg.pth + +%if 0%{?with_python3} +%files -n python3-%{pypi_name} +%doc README.txt +%{python3_sitelib}/xstatic/pkg/d3 +%{python3_sitelib}/XStatic_D3-%{version}-py%{python3_version}.egg-info +%{python3_sitelib}/XStatic_D3-%{version}-py%{python3_version}-nspkg.pth +%endif + +%files -n xstatic-d3-common +%doc README.txt %{_jsdir}/d3 %changelog +* Wed Oct 12 2016 Jan Beran - 3.1.6.2-6 +- Provides a Python 3 subpackage + * Tue Jul 19 2016 Fedora Release Engineering - 3.1.6.2-5 - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages