Initial import

This commit is contained in:
Orion Poplawski 2016-01-12 16:52:28 -07:00
parent 4f749574d5
commit ec28c775cd
5 changed files with 165 additions and 0 deletions

54
macros.python Normal file
View File

@ -0,0 +1,54 @@
%py_setup setup.py
%py_shbang_opts -s
%py_build() %{expand:\
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py_shbang_opts}" %{?1}\
}
%py_install() %{expand:\
CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
}
%python_provide() %{lua:\
function string.starts(String,Start)\
return string.sub(String,1,string.len(Start))==Start\
end\
package = rpm.expand("%{?1:%{1}}");\
vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
if (string.starts(package, "python2-")) then\
str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr;\
print(rpm.expand(str));\
print("\\nProvides: python-");\
print(string.sub(package,9,string.len(package)));\
print(" = ");\
print(vr);\
--Obsoleting the previous default python package\
str = "\\nObsoletes: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} < " .. vr;\
print(rpm.expand(str));\
print("\\nObsoletes: python-");\
print(string.sub(package,9,string.len(package)));\
print(" < ");\
print(vr);\
elseif (string.starts(package, "python3-")) then\
--No unversioned provides as python3 is not default\
elseif (string.starts(package, "pypy-")) then\
--No unversioned provides as pypy is not default\
elseif (string.starts(package, "pypy3-")) then\
--No unversioned provides as pypy is not default\
elseif (string.starts(package, "python-")) then\
--Providing the current default python\
print("Provides: python2-");\
print(string.sub(package,8,string.len(package)));\
print(" = ");\
print(vr);\
else\
print("ERROR: ");\
print(package);\
print("not recognized.");\
end\
}
# Set to /bin/true to avoid %ifdefs in specfiles
%__python3_other /bin/true
%py3_other_build /bin/true
%py3_other_install /bin/true

3
macros.python-srpm Normal file
View File

@ -0,0 +1,3 @@
# python3_pkgversion specifies the version of Python 3 in the distro. It can be
# a specific version (e.g. 34 in Fedora EPEL7)
%python3_pkgversion 3

15
macros.python2 Normal file
View File

@ -0,0 +1,15 @@
%__python2 /usr/bin/python2
%python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
%python2_version %(%{__python2} -c "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
%python2_version_nodots %(%{__python2} -c "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
%py2_shbang_opts -s
%py2_build() %{expand:\
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?1}\
}
%py2_install() %{expand:\
CFLAGS="%{optflags}" %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
}

16
macros.python3 Normal file
View File

@ -0,0 +1,16 @@
%__python3 /usr/bin/python3
%python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
%python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")
%python3_version_nodots %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3].replace('.',''))")
%py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
%py3_shbang_opts -s
%py3_build() %{expand:\
CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} build --executable="%{__python3} %{py3_shbang_opts}" %{?1}\
}
%py3_install() %{expand:\
CFLAGS="%{optflags}" %{__python3} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?1}\
}

77
python-rpm-macros.spec Normal file
View File

@ -0,0 +1,77 @@
Name: python-rpm-macros
Version: 3
Release: 3%{?dist}
Summary: The unversioned Python RPM macros
License: MIT
Source0: macros.python
Source1: macros.python-srpm
Source2: macros.python2
Source3: macros.python3
BuildArch: noarch
Obsoletes: python-macros < 3
Provides: python-macros = %{version}-%{release}
%description
This package contains the unversioned Python RPM macros, that most
implementations should rely on.
You should not need to install this package manually as the various
python?-devel packages require it. So install a python-devel package instead.
%package -n python-srpm-macros
Summary: RPM macros for building Python source packages
%description -n python-srpm-macros
RPM macros for building Python source packages.
%package -n python2-macros
Summary: RPM macros for building Python 2 packages
# Would need to be different for each release - worth it?
#Conflicts: python2-devel < 2.7.11-3
%description -n python2-macros
RPM macros for building Python 2 packages.
%package -n python3-macros
Summary: RPM macros for building Python 3 packages
# Would need to be different for each release - worth it?
#Conflicts: python3-devel < 3.5.1-3
%description -n python3-macros
RPM macros for building Python 3 packages.
%prep
%build
%install
mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/
install -m 644 %{SOURCE0} %{SOURCE1} %{SOURCE2} %{SOURCE3} \
%{buildroot}/%{_rpmconfigdir}/macros.d/
%files
%{_rpmconfigdir}/macros.d/macros.python
%files -n python-srpm-macros
%{_rpmconfigdir}/macros.d/macros.python-srpm
%files -n python2-macros
%{_rpmconfigdir}/macros.d/macros.python2
%files -n python3-macros
%{_rpmconfigdir}/macros.d/macros.python3
%changelog
* Thu Jan 8 2016 Orion Poplawski <orion@cora.nwra.com> 3-3
- Add empty %%prep and %%build
* Mon Jan 4 2016 Orion Poplawski <orion@cora.nwra.com> 3-2
- Combined package
* Wed Dec 30 2015 Orion Poplawski <orion@cora.nwra.com> 3-1
- Initial package