Skip to content

Commit

Permalink
#3945 build packages for 'PYTHON3' env var version
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Jul 28, 2023
1 parent 8e62cc8 commit 05211d2
Show file tree
Hide file tree
Showing 11 changed files with 280 additions and 149 deletions.
40 changes: 27 additions & 13 deletions packaging/rpm/python3-Cython.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
%define _disable_source_fetch 0

Name: python3-Cython
%if "%{getenv:PYTHON3}" == ""
%global python3 python3
%define bin_prefix %{nil}
%else
%global python3 %{getenv:PYTHON3}
%define bin_prefix %{python3}-
%undefine __pythondist_requires
%undefine __python_requires
%endif
%define python3_sitelib %(%{python3} -Ic "from sysconfig import get_path; print(get_path('purelib').replace('/usr/local/', '/usr/'))")
%define python3_sitearch %(%{python3} -Ic "from sysconfig import get_path; print(get_path('platlib').replace('/usr/local/', '/usr/'))")

Name: %{python3}-Cython
Version: 3.0.0
Release: 1%{?dist}
Summary: A language for writing Python extension modules
Expand All @@ -9,10 +20,10 @@ License: Python
URL: http://www.cython.org
Source0: https://github.com/cython/cython/archive/refs/tags/%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: python3
Requires: %{python3}

BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: %{python3}-devel
BuildRequires: %{python3}-setuptools
BuildRequires: gcc

%description
Expand All @@ -28,28 +39,31 @@ fi
%setup -q -n cython-%{version}

%build
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
CFLAGS="$RPM_OPT_FLAGS" %{python3} setup.py build

%install
rm -rf %{buildroot}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests
# RHEL stream setuptools bug?
%{python3} setup.py install -O1 --skip-build --root %{buildroot}
rm -fr %{buildroot}%{python3_sitearch}/UNKNOWN-*.egg-info
%if "%{bin_prefix}" != ""
mv %{buildroot}%{_bindir}/cygdb %{buildroot}%{_bindir}/%{bin_prefix}cygdb
mv %{buildroot}%{_bindir}/cython %{buildroot}%{_bindir}/%{bin_prefix}cython
mv %{buildroot}%{_bindir}/cythonize %{buildroot}%{_bindir}/%{bin_prefix}cythonize
%endif

%clean
rm -rf %{buildroot}

#these tests take way too long:
#%check
#%{__python3} runtests.py -x numpy
#%{python3} runtests.py -x numpy

%files
%defattr(-,root,root,-)
%{python3_sitearch}/*
%{_bindir}/cygdb
%{_bindir}/cython
%{_bindir}/cythonize
%{_bindir}/%{bin_prefix}cygdb
%{_bindir}/%{bin_prefix}cython
%{_bindir}/%{bin_prefix}cythonize
%doc *.txt Demos Tools

%changelog
Expand Down
34 changes: 21 additions & 13 deletions packaging/rpm/python3-aioquic.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
%define _disable_source_fetch 0

Name: python3-aioquic
%if "%{getenv:PYTHON3}" == ""
%global python3 python3
%else
%global python3 %{getenv:PYTHON3}
%undefine __pythondist_requires
%undefine __python_requires
%endif
%define python3_sitearch %(%{python3} -Ic "from sysconfig import get_path; print(get_path('platlib').replace('/usr/local/', '/usr/'))")

Name: %{python3}-aioquic
Version: 0.9.21
Release: 1%{?dist}
Summary: aioquic is a library for the QUIC network protocol in Python
Expand All @@ -9,17 +17,17 @@ License: MIT
URL: https://github.com/aiortc/aioquic
Source0: https://files.pythonhosted.org/packages/29/fe/1099419da44ce9ee372463a7ba8b6cd94c0187e7bb1e9fa5e7a997b09683/aioquic-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-wheel
BuildRequires: %{python3}-devel
BuildRequires: %{python3}-setuptools
BuildRequires: %{python3}-wheel
BuildRequires: openssl-devel
BuildRequires: gcc
Requires: python3
Requires: python3-cryptography
Requires: python3-certifi
Requires: python3-pyOpenSSL
Requires: python3-pylsqpack
Recommends: python3-uvloop
Requires: %{python3}
Requires: %{python3}-cryptography
Requires: %{python3}-certifi
Requires: %{python3}-pyOpenSSL
Requires: %{python3}-pylsqpack
Recommends: %{python3}-uvloop

%description
It features a minimal TLS 1.3 implementation, a QUIC stack and an HTTP/3 stack.
Expand All @@ -40,12 +48,12 @@ fi


%build
%{__python3} setup.py build
%{python3} setup.py build


%install
rm -rf $RPM_BUILD_ROOT
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%{python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
# RHEL stream setuptools bug?
rm -fr %{buildroot}%{python3_sitearch}/UNKNOWN-*.egg-info

Expand Down
30 changes: 15 additions & 15 deletions packaging/rpm/python3-cairo.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
%define _disable_source_fetch 0
%if "%{getenv:PYTHON3}" == ""
%global python3 python3
%else
%global python3 %{getenv:PYTHON3}
%undefine __pythondist_requires
%undefine __python_requires
%endif
%define python3_sitelib %(%{python3} -Ic "from sysconfig import get_path; print(get_path('purelib').replace('/usr/local/', '/usr/'))")
%define python3_sitearch %(%{python3} -Ic "from sysconfig import get_path; print(get_path('platlib').replace('/usr/local/', '/usr/'))")

Name: pycairo
Version: 1.20.0
Expand All @@ -12,28 +21,24 @@ Source0: https://github.com/pygobject/pycairo/releases/download/v%{version}/pyca
BuildRequires: cairo-devel
BuildRequires: gcc
BuildRequires: pkgconfig
BuildRequires: python3-devel
%if !0%{?ol8}
BuildRequires: python3-pytest
%endif
BuildRequires: python3-setuptools
BuildRequires: %{python3}-devel
BuildRequires: %{python3}-setuptools

%description
Python bindings for the cairo library.

%package -n python3-cairo
%package -n %{python3}-cairo
Summary: Python 3 bindings for the cairo library
%{?python_provide:%python_provide python3-cairo}

%description -n python3-cairo
%description -n %{python3}-cairo
Python 3 bindings for the cairo library.

%package -n python3-cairo-devel
%package -n %{python3}-cairo-devel
Summary: Libraries and headers for py3cairo
Requires: python3-cairo%{?_isa} = %{version}-%{release}
Requires: python3-devel

%description -n python3-cairo-devel
%description -n %{python3}-cairo-devel
This package contains files required to build wrappers for cairo add-on
libraries so that they interoperate with py3cairo.

Expand All @@ -53,11 +58,6 @@ fi
# RHEL stream setuptools bug?
rm -fr %{buildroot}%{python3_sitearch}/UNKNOWN-*.egg-info

%check
%if !0%{?ol8}
%{__python3} setup.py test
%endif

%files -n python3-cairo
%license COPYING*
%{python3_sitearch}/cairo/
Expand Down
34 changes: 22 additions & 12 deletions packaging/rpm/python3-pycuda.spec
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@
%define __requires_exclude ^libcuda.*$

%define _disable_source_fetch 0
%if "%{getenv:PYTHON3}" == ""
%global python3 python3
%else
%global python3 %{getenv:PYTHON3}
%undefine __pythondist_requires
%undefine __python_requires
%endif
%define python3_sitearch %(%{python3} -Ic "from sysconfig import get_path; print(get_path('platlib').replace('/usr/local/', '/usr/'))")

%global debug_package %{nil}

%define STUBS_DIR targets/x86_64-linux/lib/stubs/
%ifarch aarch64
%define STUBS_DIR targets/sbsa-linux/lib/stubs/
%endif

Name: python3-pycuda
Name: %{python3}-pycuda
%if !0%{?el8}
Version: 2022.2.2
%else
Expand All @@ -32,24 +41,25 @@ Source0: https://files.pythonhosted.org/packages/78/09/9df5358ffb74d22524
Source0: https://files.pythonhosted.org/packages/2d/1f/48a3a5b2c715345e7af1e09361100bd98c3d72b4025371692ab233f523d3/pycuda-%{version}.tar.gz
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: python3-pycuda
Provides: %{python3}-pycuda

BuildRequires: make
BuildRequires: gcc-c++
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-numpy
BuildRequires: %{python3}-devel
BuildRequires: %{python3}-setuptools
BuildRequires: %{python3}-numpy
BuildRequires: boost-python3-devel
BuildRequires: libglvnd-devel
BuildRequires: cuda

%description
PyCUDA lets you access Nvidia‘s CUDA parallel computation API from Python.

Requires: python3-decorator
Requires: python3-numpy
Requires: python3-pytools
Requires: python3-six

Requires: %{python3}-decorator
Requires: %{python3}-numpy
Requires: %{python3}-pytools
Requires: %{python3}-six

Suggests: nvidia-driver-cuda-libs

Expand All @@ -67,7 +77,7 @@ fi

%build
CUDA=/opt/cuda
%{__python3} ./configure.py \
%{python3} ./configure.py \
--cuda-enable-gl \
--cuda-root=$CUDA \
--cudadrv-lib-dir=%{_libdir} \
Expand All @@ -76,12 +86,12 @@ CUDA=/opt/cuda
--no-cuda-enable-curand
# --boost-python-libname=boost_python37
# --boost-thread-libname=boost_thread
LDFLAGS=-L$CUDA/%{STUBS_DIR} CXXFLAGS=-L$CUDA/%{STUBS_DIR} %{__python3} setup.py build
LDFLAGS=-L$CUDA/%{STUBS_DIR} CXXFLAGS=-L$CUDA/%{STUBS_DIR} %{python3} setup.py build
#make

%install
CUDA=/opt/cuda
LDFLAGS=-L$CUDA/%{STUBS_DIR} CXXFLAGS=-L$CUDA/%{STUBS_DIR} %{__python3} setup.py install --prefix=%{_prefix} --root=%{buildroot}
LDFLAGS=-L$CUDA/%{STUBS_DIR} CXXFLAGS=-L$CUDA/%{STUBS_DIR} %{python3} setup.py install --prefix=%{_prefix} --root=%{buildroot}
# RHEL stream setuptools bug?
rm -fr %{buildroot}%{python3_sitearch}/UNKNOWN-*.egg-info

Expand Down
20 changes: 14 additions & 6 deletions packaging/rpm/python3-pylsqpack.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
%define _disable_source_fetch 0
%if "%{getenv:PYTHON3}" == ""
%global python3 python3
%else
%global python3 %{getenv:PYTHON3}
%undefine __pythondist_requires
%undefine __python_requires
%endif
%define python3_sitearch %(%{python3} -Ic "from sysconfig import get_path; print(get_path('platlib').replace('/usr/local/', '/usr/'))")

Name: python3-pylsqpack
Name: %{python3}-pylsqpack
Version: 0.3.17
Release: 1%{?dist}
Summary: pylsqpack is a wrapper around the ls-qpack library
Expand All @@ -9,10 +17,10 @@ License: MIT
URL: https://github.com/aiortc/pylsqpack
Source0: https://files.pythonhosted.org/packages/40/15/e38751187d1db74efce30d45e72ae0035e506101585e28eee525bc465f7e/pylsqpack-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: %{python3}-devel
BuildRequires: %{python3}-setuptools
BuildRequires: gcc
Requires: python3
Requires: %{python3}

%description
It provides Python Decoder and Encoder objects
Expand All @@ -29,12 +37,12 @@ fi


%build
%{__python3} setup.py build
%{python3} setup.py build


%install
rm -rf $RPM_BUILD_ROOT
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%{python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
# RHEL stream setuptools bug?
rm -fr %{buildroot}%{python3_sitearch}/UNKNOWN-*.egg-info

Expand Down
20 changes: 14 additions & 6 deletions packaging/rpm/python3-pynvml.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,20 @@
# later version. See the file COPYING for details.

%define _disable_source_fetch 0
%if "%{getenv:PYTHON3}" == ""
%global python3 python3
%else
%global python3 %{getenv:PYTHON3}
%undefine __pythondist_requires
%undefine __python_requires
%endif
%define python3_sitelib %(%{python3} -Ic "from sysconfig import get_path; print(get_path('purelib').replace('/usr/local/', '/usr/'))")
%define python3_sitearch %(%{python3} -Ic "from sysconfig import get_path; print(get_path('platlib').replace('/usr/local/', '/usr/'))")

#this is a pure python package so debug is meaningless here:
%define debug_package %{nil}

Name: python3-pynvml
Name: %{python3}-pynvml
Version: 12.535.77
Release: 1
URL: http://pythonhosted.org/nvidia-ml-py/
Expand All @@ -16,8 +26,7 @@ License: BSD
Group: Development/Libraries/Python
Source0: https://files.pythonhosted.org/packages/d8/91/a16342ef37f198add82ef03abb84299d5cfbe7a04dab495bb1ade83fd433/nvidia-ml-py-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: python-pynvml
BuildRequires: python3-devel
BuildRequires: %{python3}-devel

%description
Python Bindings for the NVIDIA Management Library
Expand All @@ -31,13 +40,12 @@ fi
%setup -q -n nvidia-ml-py-%{version}

%build
%{__python3} ./setup.py build
%{python3} ./setup.py build

%install
%{__python3} ./setup.py install --prefix=%{_prefix} --root=%{buildroot}
%{python3} ./setup.py install --prefix=%{_prefix} --root=%{buildroot}
rm -f %{buildroot}/%{python3_sitelib}/__pycache__/example.*
rm -f %{buildroot}/%{python3_sitelib}/example.py
# RHEL stream setuptools bug?
rm -fr %{buildroot}%{python3_sitearch}/UNKNOWN-*.egg-info

%clean
Expand Down
Loading

0 comments on commit 05211d2

Please sign in to comment.