From d100b1f4de439182e7413e948ae904d16c29c9ab Mon Sep 17 00:00:00 2001 From: Johannes Kastl Date: Fri, 2 Dec 2022 07:21:29 +0000 Subject: [PATCH] Accepting request 1039495 from home:ojkastl_buildservice:Branch_systemsmanagement_ansible - rework spec file to define %ansible_python version, which is the python version, that ansible is built against, as well as %ansible_python_sitelib and %ansible_python_executable OBS-URL: https://build.opensuse.org/request/show/1039495 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:ansible/ansible?expand=0&rev=7 --- ansible.changes | 7 +++++++ ansible.spec | 28 ++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/ansible.changes b/ansible.changes index 197c278..1197430 100644 --- a/ansible.changes +++ b/ansible.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Nov 25 07:03:33 UTC 2022 - Johannes Kastl + +- rework spec file to define %ansible_python version, which is the + python version, that ansible is built against, as well as + %ansible_python_sitelib and %ansible_python_executable + ------------------------------------------------------------------- Wed Nov 23 07:27:47 UTC 2022 - Johannes Kastl diff --git a/ansible.spec b/ansible.spec index 97a3ffb..f9d93d8 100644 --- a/ansible.spec +++ b/ansible.spec @@ -15,7 +15,19 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # -%define pythons %primary_python +%if 0%{?suse_version} < 1550 +# Leap15, SLES15 +%define pythons python310 +%define ansible_python python310 +%define ansible_python_executable python3.10 +%define ansible_python_sitelib %python310_sitelib +%else +# Tumbleweed +%define pythons python3 +%define ansible_python python3 +%define ansible_python_executable python3 +%define ansible_python_sitelib %python3_sitelib +%endif Name: ansible Version: 7.0.0 @@ -26,8 +38,8 @@ URL: https://ansible.com/ Source: https://files.pythonhosted.org/packages/source/a/ansible/ansible-%{version}.tar.gz Source99: ansible-rpmlintrc BuildRequires: python-rpm-macros -BuildRequires: %{python_module base >= 3.9} -BuildRequires: %{python_module setuptools} +BuildRequires: %{ansible_python}-base >= 3.9 +BuildRequires: %{ansible_python}-setuptools BuildRequires: fdupes # required to fix the azure collection line endings @@ -37,7 +49,7 @@ BuildRequires: dos2unix BuildRequires: ansible-core >= 2.14.0 # /SECTION -Requires: %{primary_python}-base >= 3.9 +Requires: %{ansible_python}-base >= 3.9 Requires: ansible-core >= 2.14.0 BuildArch: noarch @@ -56,14 +68,14 @@ for file in .git_keep .travis.yml ; do done # fix for wrong shebang: -sed -i 's|/Users/kbreit/Documents/Programming/ansible_collections/cisco/meraki/venv/bin/python|%{_bindir}/python3|g' ansible_collections/cisco/meraki/scripts/sublime-build/build.py.generic +sed -i 's|/Users/kbreit/Documents/Programming/ansible_collections/cisco/meraki/venv/bin/python|%{_bindir}/%{ansible_python_executable}|g' ansible_collections/cisco/meraki/scripts/sublime-build/build.py.generic # Replace all #!/usr/bin/env lines to use #!/usr/bin/$1 directly. find ./ -type f -exec \ sed -i '1s|^#!%{_bindir}/env |#!%{_bindir}/|' {} \; find ./ -type f -exec \ - sed -i '1s|python$|python3|' {} \; + sed -i '1s|python$|%{ansible_python_executable}|' {} \; # remove .keep and .gitignore files find ./ansible_collections/ -iname .gitignore -delete @@ -81,12 +93,12 @@ rm -rf ./ansible_collections/lowlydba/sqlserver/ %install %python_install -%fdupes %{buildroot}/%{python_sitelib}/ansible_collections/ +%fdupes %{buildroot}/%{ansible_python_sitelib}/ansible_collections/ %files %doc CHANGELOG-v7.rst README.rst %license COPYING %{_bindir}/ansible-community -%{python_sitelib}/* +%{ansible_python_sitelib}/ %changelog