Implement alternatives
This commit is contained in:
		
							parent
							
								
									0c94eb96a6
								
							
						
					
					
						commit
						8559aff8a4
					
				| @ -63,6 +63,14 @@ Provides:       bundled(python%{python3_version}dist(packaging)) = 23 | ||||
| 
 | ||||
| %{bundled} | ||||
| 
 | ||||
| # Require alternatives version that implements the --keep-foreign flag and fixes rhbz#2203820 | ||||
| Requires(postun): alternatives >= 1.19.2-1 | ||||
| 
 | ||||
| # python3.12 installs the alternatives master symlink to which we attach a slave | ||||
| Requires:       python%{python3_pkgversion} | ||||
| Requires(post): python%{python3_pkgversion} | ||||
| Requires(postun): python%{python3_pkgversion} | ||||
| 
 | ||||
| %global _description %{expand: | ||||
| Wheel is the reference implementation of the Python wheel packaging standard, | ||||
| as defined in PEP 427. | ||||
| @ -111,6 +119,8 @@ mv %{buildroot}%{_bindir}/%{pypi_name}{,-%{python3_version}} | ||||
| ln -s %{pypi_name}-%{python3_version} %{buildroot}%{_bindir}/%{pypi_name}-3 | ||||
| ln -s %{pypi_name}-3 %{buildroot}%{_bindir}/%{pypi_name} | ||||
| %endif | ||||
| # Create an empty file to be used by `alternatives` | ||||
| touch %{buildroot}%{_bindir}/%{pypi_name}-3 | ||||
| 
 | ||||
| mkdir -p %{buildroot}%{python_wheel_dir} | ||||
| install -p dist/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir} | ||||
| @ -125,6 +135,20 @@ install -p dist/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir} | ||||
| %pytest -v --ignore build | ||||
| %endif | ||||
| 
 | ||||
| %post -n python%{python3_pkgversion}-%{pypi_name} | ||||
| alternatives --keep-foreign --add-slave python3 %{_bindir}/python%{python3_version} \ | ||||
|     %{_bindir}/%{pypi_name}-3 \ | ||||
|     %{pypi_name}-3 \ | ||||
|     %{_bindir}/%{pypi_name}-%{python3_version} | ||||
| 
 | ||||
| %postun -n python%{python3_pkgversion}-%{pypi_name} | ||||
| # Do this only during uninstall process (not during update) | ||||
| if [ $1 -eq 0 ]; then | ||||
|    alternatives --keep-foreign --remove-slave python3 %{_bindir}/python%{python3_version} \ | ||||
|        %{pypi_name}-3 | ||||
| fi | ||||
| 
 | ||||
| 
 | ||||
| %files -n python%{python3_pkgversion}-%{pypi_name} | ||||
| %license LICENSE.txt | ||||
| %doc README.rst | ||||
| @ -133,6 +157,7 @@ install -p dist/%{python_wheel_name} -t %{buildroot}%{python_wheel_dir} | ||||
| %{_bindir}/%{pypi_name} | ||||
| %{_bindir}/%{pypi_name}-3 | ||||
| %endif | ||||
| %ghost %{_bindir}/%{pypi_name}-3 | ||||
| %{python3_sitelib}/%{pypi_name}*/ | ||||
| 
 | ||||
| %files -n %{python_wheel_pkg_prefix}-%{pypi_name}-wheel | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user