From 682d207977e26b6236089ce4d3f5853d96af30b0 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Jan 15 2017 01:52:31 +0000 Subject: Update to 2.0 Signed-off-by: Igor Gnatenko --- diff --git a/.gitignore b/.gitignore index e07e1df..19c00ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ line_profiler-1.0b2.tar.gz /line_profiler-1.0.tar.gz +/line_profiler-2.0.tar.gz diff --git a/python-line_profiler.spec b/python-line_profiler.spec index a4c0f4e..e2a1ae3 100644 --- a/python-line_profiler.spec +++ b/python-line_profiler.spec @@ -1,126 +1,99 @@ -# Set python3 as default on fedora -%if 0%{?fedora} -%global with_python3 1 -%endif - -# Set python2 related macros -%if 0%{?rhel} && 0%{?rhel} <= 6 -%{!?__python2: %global __python2 /usr/bin/python2} -%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} -%endif - %global pkgname line_profiler Name: python-%{pkgname} -Version: 1.0 -Release: 10%{?dist} +Version: 2.0 +Release: 1%{?dist} Summary: Line-by-line profiler for python License: BSD and Python -URL: https://github.com/rkern/%{pkgname} -Source0: https://pypi.python.org/packages/source/l/%{pkgname}/%{pkgname}-%{version}.tar.gz +URL: https://github.com/rkern/line_profiler +Source0: %{url}/archive/%{version}/%{pkgname}-%{version}.tar.gz -BuildRequires: python2-devel -BuildRequires: python-setuptools -Requires: python2 -Provides: python2-%{pkgname} = %{version}-%{release} - -%description -line_profiler is a module for doing line-by-line profiling of functions. -kernprof is a convenient script for running either line_profiler or -the Python standard library's cProfile or profile modules, +BuildRequires: gcc + +%global _description \ +line_profiler is a module for doing line-by-line profiling of functions.\ +kernprof is a convenient script for running either line_profiler or\ +the Python standard library's cProfile or profile modules,\ depending on what is available. -%if 0%{?with_python3} +%description %{_description} + +%package -n python2-%{pkgname} +Summary: %{summary} +%{?python_provide:%python_provide python2-%{pkgname}} +BuildRequires: python2-devel +BuildRequires: python2-setuptools +BuildRequires: python2-Cython +BuildRequires: python2-ipython-console +Requires: python2-ipython-console + +%description -n python2-%{pkgname} %{_description} + +Python 2 version. + %package -n python3-%{pkgname} -Summary: Line-by-line profiler for python3 +Summary: %{summary} +%{?python_provide:%python_provide python3-%{pkgname}} BuildRequires: python3-devel BuildRequires: python3-setuptools -Requires: python3 -%description -n python3-%{pkgname} -line_profiler is a module for doing line-by-line profiling of functions. -kernprof is a convenient script for running either line_profiler or -the Python standard library's cProfile or profile modules, -depending on what is available. -%endif +BuildRequires: python3-Cython +BuildRequires: python3-ipython-console +Requires: python3-ipython-console -%prep -%setup -q -c +%description -n python3-%{pkgname} %{_description} -%if 0%{?with_python3} -# Prepare python3 directory. Do not use py3dir as it is unclean. -cp -a %{pkgname}-%{version} python3 -find python3 -name '*.py' | xargs sed -i '/^#!\/usr\/bin\/env\ python/d' -%endif +Python 3 version. -find %{pkgname}-%{version} -name '*.py' | xargs sed -i '/^#!\/usr\/bin\/env\ python/d' -rm -rf *.egg-info +%prep +%autosetup -n %{pkgname}-%{version} +sed -i -e '1{\@^#!/usr/bin/env python@d}' %{pkgname}.py kernprof.py %build -# Build with python3 -%if 0%{?with_python3} -pushd python3 -CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build -popd -%endif - -# Build with python2 -pushd %{pkgname}-%{version} -CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build -popd +%py2_build +%py3_build %install -# Install with python3 -%if 0%{?with_python3} -pushd python3 -%{__python3} setup.py install --skip-build --root=%{buildroot} -mv %{buildroot}%{_bindir}/kernprof %{buildroot}%{_bindir}/kernprof-%{python3_version} -popd -%endif - -# Install with python2 -pushd %{pkgname}-%{version} -%{__python2} setup.py install --skip-build --root=%{buildroot} -mv %{buildroot}%{_bindir}/kernprof %{buildroot}%{_bindir}/kernprof-%{python2_version} -ln -s %{_bindir}/kernprof-%{python2_version} %{buildroot}%{_bindir}/kernprof -popd +%py3_install +mv %{buildroot}%{_bindir}/kernprof{,-%{python3_version}} +ln -s kernprof-%{python3_version} %{buildroot}%{_bindir}/kernprof-3 +%py2_install +mv %{buildroot}%{_bindir}/kernprof{,-%{python2_version}} +ln -s kernprof-%{python2_version} %{buildroot}%{_bindir}/kernprof-2 +ln -s kernprof-2 %{buildroot}%{_bindir}/kernprof %check -# Run tests with python3 -%if 0%{?with_python3} -pushd python3 +PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} -m unittest discover -s tests -v PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m unittest discover -s tests -v -popd -%endif -# Run tests with python2 -pushd %{pkgname}-%{version} -PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} -m unittest discover -s tests -v -popd - -%files -%doc %{pkgname}-%{version}/README.rst -# BSD License -%license %{pkgname}-%{version}/LICENSE.txt -# Python License -%license %{pkgname}-%{version}/LICENSE_Python.txt -%{python2_sitearch}/* +%files -n python2-%{pkgname} +%license LICENSE.txt LICENSE_Python.txt +%doc README.rst +%{python2_sitearch}/%{pkgname}-*.egg-info/ +%{python2_sitearch}/_%{pkgname}.so +%{python2_sitearch}/%{pkgname}.py* +%{python2_sitearch}/kernprof.py* %{_bindir}/kernprof +%{_bindir}/kernprof-2 %{_bindir}/kernprof-%{python2_version} -%if 0%{?with_python3} %files -n python3-%{pkgname} -%doc %{pkgname}-%{version}/README.rst -# BSD License -%license %{pkgname}-%{version}/LICENSE.txt -# Python License -%license %{pkgname}-%{version}/LICENSE_Python.txt -%exclude %dir %{python3_sitearch}/__pycache__ -%{python3_sitearch}/* +%license LICENSE.txt LICENSE_Python.txt +%doc README.rst +%{python3_sitearch}/%{pkgname}-*.egg-info/ +%{python3_sitearch}/_%{pkgname}.*.so +%{python3_sitearch}/%{pkgname}.py +%{python3_sitearch}/__pycache__/%{pkgname}.* +%{python3_sitearch}/kernprof.py +%{python3_sitearch}/__pycache__/kernprof.* +%{_bindir}/kernprof-3 %{_bindir}/kernprof-%{python3_version} -%endif %changelog +* Sun Jan 15 2017 Igor Gnatenko - 2.0-1 +- Update to 2.0 +- Modernize spec + * Mon Dec 19 2016 Miro HronĨok - 1.0-10 - Rebuild for Python 3.6 diff --git a/sources b/sources index 3822715..5836ded 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -2f8352acfedf83f701a564583db5e14d line_profiler-1.0.tar.gz +SHA512 (line_profiler-2.0.tar.gz) = 731de50dfab2f863c47a9f777e9ea07ec4bc7ec20abc631abafe365c1e0c46d59db2b50b4e755955c0e3b858a0baac85a2b11ddb458785ee369dda5290c5343c