Add %python3_platform_triplet and %python3_ext_suffix
Also add %python_platform_triplet and %python_ext_suffix. The CI tests are limited to x86_64 for now. https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names
This commit is contained in:
parent
a712d455f8
commit
06987f5024
@ -5,6 +5,8 @@
|
||||
%python_version %(%{__python} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
|
||||
%python_version_nodots %(%{__python} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
|
||||
%python_platform %(%{__python} -Esc "import sysconfig; print(sysconfig.get_platform())")
|
||||
%python_platform_triplet %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
|
||||
%python_ext_suffix %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
|
||||
|
||||
%py_setup setup.py
|
||||
%py_shbang_opts -s
|
||||
|
@ -3,6 +3,8 @@
|
||||
%python3_version %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
|
||||
%python3_version_nodots %(%{__python3} -Ic "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
|
||||
%python3_platform %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_platform())")
|
||||
%python3_platform_triplet %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
|
||||
%python3_ext_suffix %(%{__python3} -Ic "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
|
||||
%py3dir %{_builddir}/python3-%{name}-%{version}-%{release}
|
||||
|
||||
%py3_shbang_opts -s
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: python-rpm-macros
|
||||
Version: 3.9
|
||||
Release: 9%{?dist}
|
||||
Release: 10%{?dist}
|
||||
Summary: The common Python RPM macros
|
||||
|
||||
# macros and lua: MIT, compileall2.py: PSFv2
|
||||
@ -107,6 +107,10 @@ install -m 644 compileall2.py %{buildroot}%{_rpmconfigdir}/redhat/
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Sep 14 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9-10
|
||||
- Add %%python3_platform_triplet and %%python3_ext_suffix
|
||||
- https://fedoraproject.org/wiki/Changes/Python_Upstream_Architecture_Names
|
||||
|
||||
* Fri Jul 24 2020 Lumír Balhar <lbalhar@redhat.com> - 3.9-9
|
||||
- Adapt %%py[3]_shebang_fix to use versioned pathfixX.Y.py
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import os
|
||||
import subprocess
|
||||
import platform
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
@ -398,6 +399,8 @@ unversioned_macros = pytest.mark.parametrize('macro', [
|
||||
'%python_sitelib',
|
||||
'%python_sitearch',
|
||||
'%python_platform',
|
||||
'%python_platform_triplet',
|
||||
'%python_ext_suffix',
|
||||
'%py_shebang_fix',
|
||||
'%py_build',
|
||||
'%py_build_egg',
|
||||
@ -419,3 +422,17 @@ def test_unversioned_python_errors(macro):
|
||||
def test_unversioned_python_works_when_defined(macro):
|
||||
macro3 = macro.replace('python', 'python3').replace('py_', 'py3_')
|
||||
assert rpm_eval(macro, __python='/usr/bin/python3') == rpm_eval(macro3)
|
||||
|
||||
|
||||
# we could rework the test for multiple architectures, but the Fedora CI currently only runs on x86_64
|
||||
x86_64_only = pytest.mark.skipif(platform.machine() != "x86_64", reason="works on x86_64 only")
|
||||
|
||||
|
||||
@x86_64_only
|
||||
def test_platform_triplet():
|
||||
assert rpm_eval("%python3_platform_triplet")[0] == "x86_64-linux-gnu"
|
||||
|
||||
|
||||
@x86_64_only
|
||||
def test_ext_suffix():
|
||||
assert rpm_eval("%python3_ext_suffix")[0] == f".cpython-{XY}-x86_64-linux-gnu.so"
|
||||
|
Loading…
Reference in New Issue
Block a user