summaryrefslogtreecommitdiffstats
path: root/python-coverage.spec
blob: 71dc5209276ce76b4c7d411624317d070b3b6a96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%global with_python3 1
%endif

Name:           python-coverage
Summary:        Code coverage testing module for Python
Version:        3.2
Release:        3
License:        BSD
Group:          System Environment/Libraries
URL:            http://nedbatchelder.com/code/modules/coverage.html
Source0:        http://pypi.python.org/packages/source/c/coverage/coverage-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  python-setuptools, python-devel
Requires:       python-setuptools
%if 0%{?with_python3}
BuildRequires:  /usr/bin/2to3
BuildRequires:  python3-setuptools, python3-devel
%endif # with_python3

%global SHARED_DESC \
Coverage.py is a Python module that measures code coverage during Python\
execution. It uses the code analysis tools and tracing hooks provided in the\
Python standard library to determine which lines are executable, and which\
have been executed.\
%{nil}


%description
%SHARED_DESC

# Define the metadata for each built package:
%(rpm-pyconfig --foreach --eval "
%package -n @confpkg-coverage
Summary: Code coverage testing module for @confpkg
Group: System Environment/Libraries
Requires: @confpkg-setuptools
%description -n @confpkg-coverage
%SHARED_DESC

@confdescline
")

%prep
%setup -q -n coverage-%{version}
chmod -x README.txt
sed -i 's/\r//g' README.txt
chmod -x coverage.egg-info/*.txt

# Generate pristine Python 2 code
cp -a . ../pristine

# Generate pristine Python 3 code
rpm-pyconfig --ifany-3 && (
   rm -rf %{py3dir}
   cp -a . %{py3dir}
   pushd %{py3dir}
   2to3 --nobackups --write .
   popd
)

# Each config gets its own source tree.  This is possibly paranoid
rpm-pyconfig --foreach-2 --exe \
   "cp -a ../pristine @confsrcdir"

rpm-pyconfig --foreach-3 --exe \
   "cp -a %{py3dir} @confsrcdir"

%build
%(rpm-pyconfig --foreach --eval "
    pushd @confsrcdir
    @confbin setup.py build
    popd
")

%install
rm -rf %{buildroot}

%(rpm-pyconfig --foreach --eval "
    pushd @confsrcdir
    @confbin setup.py install -O1 --skip-build --root %{buildroot}
    mv %{buildroot}/%{_bindir}/coverage %{buildroot}/%{_bindir}/@confbin-coverage
    popd
")

%clean
rm -rf %{buildroot}

# %files for the various subpackages:
%(rpm-pyconfig --foreach --eval "
%files -n @confpkg-coverage
%defattr(-,root,root,-)
%doc README.txt
%{_bindir}/@confbin-coverage
@conf_sitearch/coverage/
@conf_sitearch/coverage*.egg-info/
")


%changelog
* Fri Feb  5 2010 David Malcolm <dmalcolm@redhat.com> - 3.2-3
- add python 3 subpackage (#536948)

* Sun Jan 17 2010 Luke Macken <lmacken@redhat.com> - 3.2-2
- Require python-setuptools (#556290)

* Wed Dec  9 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 3.2-1
- update to 3.2

* Fri Oct 16 2009 Luke Macken <lmacken@redhat.com> - 3.1-1
- Update to 3.1

* Wed Aug 10 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 3.0.1-1
- update to 3.0.1

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.85-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Fri May 15 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 2.85-2
- fix install invocation

* Wed May 6 2009 Tom "spot" Callaway <tcallawa@redhat.com> - 2.85-1
- Initial package for Fedora