source: ProjectBuilder/projects/python-formats/pbconf/python-formats/rpm/python-formats.spec@ 2478

Last change on this file since 2478 was 2478, checked in by Bruno Cornec, 4 years ago

Fix python-formats build with the 2 python versions when needed

File size: 1.5 KB
RevLine 
[2407]1#
2# $Id$
3#
4# Used if virtual name != real name (perl, ...) - replace PBPKG by PBREALPKG in the line below
5%define srcname PBPKG
[2478]6%define shortname formats
[2407]7%define py3 PBPY3
[2478]8%define py2 PBPY2
9%define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
[2407]10
11Summary: PBSUMMARY
12
[2478]13Name: PBPKG
[2407]14Version: PBVER
15Release: PBTAGPBSUF
16License: PBLIC
17Group: PBGRP
18Url: PBURL
19Source: PBREPO/PBSRC
20BuildArch: noarch
21#PBPATCHSRC
22
[2478]23%if %py2
24#Requires: PBDEP
25BuildRequires: PBBDEP
26
[2407]27%description
28PBDESC
29python2 version
[2478]30%endif
[2407]31
32%if %py3
[2478]33%if %py2
34%package -n python3-%{shortname}
35%endif
36#Requires: PBDEP
37BuildRequires: PBBDEP
[2407]38
[2478]39%if %py2
40Summary: PBSUMMARY / Python3 version
41%description -n python3-%{shortname}
42%else
43%description
44%endif
[2407]45PBDESC
46python3 version
47%endif
48
49%prep
[2478]50%setup -q -n PBPKG-%{version}PBEXTDIR
[2407]51%if %py3
52cd ..
[2478]53cp -fr PBPKG-%{version}PBEXTDIR python3
[2407]54cd -
55%endif
56#PBPATCHCMD
57
58%build
[2478]59%if %py2
[2407]60%{__python} setup.py build
[2478]61%endif
[2407]62%if %py3
63cd ../python3
[2478]64python3 setup.py build
[2407]65cd -
66%endif
67
68%install
69%{__rm} -rf %{buildroot}
[2478]70%if %py2
[2407]71%{__python} setup.py install -O1 --skip-build --root %{buildroot}
[2478]72%endif
[2407]73%if %py3
74cd ../python3
[2478]75python3 setup.py install -O1 --skip-build --root %{buildroot}
[2407]76cd -
77%endif
78
[2478]79%if %py2
[2407]80%files
81%doc README.rst
82%{python_sitelib}/*
[2478]83%endif
[2407]84
85%if %py3
[2478]86%if %py2
87%files -n python3-%{shortname}
88%else
89%files
90%endif
[2407]91%doc README.rst
92%{python3_sitelib}/*
93%endif
94
95%changelog
96PBLOG
Note: See TracBrowser for help on using the repository browser.