$90 GRAYBYTE WORDPRESS FILE MANAGER $14

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib/rpm/macros.d/

HOME
Current File : /usr/lib/rpm/macros.d//macros.python-srpm
# 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

# Set to /bin/true to avoid %ifdefs and %{? in specfiles
%__python3_other /bin/true
%py3_other_build /bin/true
%py3_other_install /bin/true

# Define where Python wheels will be stored and the prefix of -wheel packages
# - In Fedora we want wheel subpackages named e.g. `python-pip-wheel` that
#   install packages into `/usr/share/python-wheels`. Both names are not
#   versioned, because they're used by all Python 3 stacks.
# - In RHEL we want wheel packages named e.g. `python3-pip-wheel` and
#   `python3.11-pip-wheel` that install packages into similarly versioned
#   locations. We want each Python stack in RHEL to have their own wheels,
#   because the main python3 wheels (which we can't upgrade) will likely be
#   quite old by the time we're adding new alternate Python stacks.
# - In ELN we want to follow Fedora, because builds for ELN and Fedora rawhide
#   need to be interoperable.
%python_wheel_pkg_prefix python%{?rhel:%{!?eln:%{python3_pkgversion}}}
%python_wheel_dir %{_datadir}/%{python_wheel_pkg_prefix}-wheels


# === Macros for Build/Requires tags using Python dist tags ===
# - https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
# - These macros need to be in macros.python-srpm, because BuildRequires tags
#   get rendered as runtime requires into the metadata of SRPMs.

# Converts Python dist name to a canonical format
%py_dist_name() %{lua:\
        name = rpm.expand("%{?1:%{1}}");\
        canonical = string.gsub(string.lower(name), "[^%w%.]+", "-");\
        print(canonical);\
}

# Creates Python 2 dist tag(s) after converting names to canonical format
#   Needs to first put all arguments into a list, because invoking a different
#   macro (%py_dist_name) overwrites them
%py2_dist() %{lua:\
        args = {}\
        arg = 1\
        while (true) do\
                name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
                if (name == nil or name == '') then\
                        break\
                end\
                args[arg] = name\
                arg = arg + 1\
        end\
        for arg, name in ipairs(args) do\
                canonical = rpm.expand("%py_dist_name " .. name);\
                print("python2dist(" .. canonical .. ") ");\
        end\
}

# RHEL 9+ and Fedora compatibility macro
# Only use in macro backports, not intended to be used in spec files!
# In the future, the %%python3_pkgversion macro has a dot, e.g. 3.9 or 3.11
# However, in RHEL 8 at least, it does not, e.g. 38, 39
# This is a helpful macro that determines the proper "Python version" string with dot
# from %%python3_pkgversion without actually having Python installed.
# For values other than 3X, it should expand to %%python3_pkgversion unchanged.
# Examples of %%python3_pkgversion -> %%_python3_pkgversion_with_dot:
#   3    -> 3
#   38   -> 3.8
#   39   -> 3.9
#   310  -> 3.10
#   3.12 -> 3.12
#   4    -> 4
#   412  -> 412
%_python3_pkgversion_with_dot %{lua:print((rpm.expand("%python3_pkgversion"):gsub('^3(%d)', '3.%1')))}

# Creates Python 3 dist tag(s) after converting names to canonical format
#   Needs to first put all arguments into a list, because invoking a different
#   macro (%py_dist_name) overwrites them
%py3_dist() %{lua:\
        python3_pkgversion_with_dot = rpm.expand("%_python3_pkgversion_with_dot")\
        args = {}\
        arg = 1\
        while (true) do\
                name = rpm.expand("%{?" .. arg .. ":%{" .. arg .. "}}");\
                if (name == nil or name == '') then\
                        break\
                end\
                args[arg] = name\
                arg = arg + 1\
        end\
        for arg, name in ipairs(args) do\
                canonical = rpm.expand("%py_dist_name " .. name);\
                print("python" .. python3_pkgversion_with_dot .. "dist(" .. canonical .. ") ");\
        end\
}

# Macro to replace overly complicated references to PyPI source files.
# Expands to the pythonhosted URL for a package
# Accepts zero to three arguments:
# 1:  The PyPI project name, defaulting to %srcname if it is defined, then
#     %pypi_name if it is defined, then just %name.
# 2:  The PYPI version, defaulting to %version with tildes stripped.
# 3:  The file extension, defaulting to "tar.gz".  (A period will be added
#     automatically.)
# Requires %__pypi_url and %__pypi_default_extension to be defined.
%__pypi_url https://files.pythonhosted.org/packages/source/
%__pypi_default_extension tar.gz

%pypi_source() %{lua:
    local src = rpm.expand('%1')
    local ver = rpm.expand('%2')
    local ext = rpm.expand('%3')
    local url = rpm.expand('%__pypi_url')
\
    -- If no first argument, try %srcname, then %pypi_name, then %name
    -- Note that rpm leaves macros unchanged if they are not defined.
    if src == '%1' then
        src = rpm.expand('%srcname')
    end
    if src == '%srcname' then
        src = rpm.expand('%pypi_name')
    end
    if src == '%pypi_name' then
        src = rpm.expand('%name')
    end
\
    -- If no second argument, use %version
    if ver == '%2' then
        ver = rpm.expand('%version'):gsub('~', '')
    end
\
    -- If no third argument, use the preset default extension
    if ext == '%3' then
        ext = rpm.expand('%__pypi_default_extension')
    end
\
    local first = string.sub(src, 1, 1)
\
    print(url .. first .. '/' .. src .. '/' .. src .. '-' .. ver .. '.' .. ext)
}

# Python packages in RHEL 8 should not provide unversioned python- names
# so this macro here is just a compatibility layer and only provides the given name.
%py_provides() %{lua:
    local name = rpm.expand('%1')
    if name == '%1' then
        rpm.expand('%{error:%%py_provides requires at least 1 argument, the name to provide}')
    end
    local evr = rpm.expand('%2')
    if evr == '%2' then
        evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')
    end
    print('Provides: ' .. name .. ' = ' .. evr .. '\\n')
}

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
12 Sep 2025 9.24 PM
root / root
0755
macros.dwz
1.764 KB
15 May 2023 9.30 PM
root / root
0644
macros.efi-srpm
3.003 KB
24 Nov 2021 5.32 AM
root / root
0644
macros.environment-modules
0.073 KB
30 Jul 2020 7.13 PM
root / root
0644
macros.fedora-misc
2.763 KB
15 May 2023 9.30 PM
root / root
0644
macros.fedora-misc-srpm
0.233 KB
15 May 2023 9.30 PM
root / root
0644
macros.firewalld
0.233 KB
11 Mar 2025 4.51 PM
root / root
0644
macros.forge
12.435 KB
15 May 2023 9.30 PM
root / root
0644
macros.ghc-srpm
0.404 KB
12 Aug 2018 5.37 PM
root / root
0644
macros.go-srpm
7.17 KB
8 Apr 2021 9.45 PM
root / root
0644
macros.info
0.381 KB
19 Apr 2022 12.09 AM
root / root
0644
macros.kernel-srpm
0.113 KB
15 May 2023 9.30 PM
root / root
0644
macros.ldc-srpm
0.071 KB
15 May 2023 9.30 PM
root / root
0644
macros.ldconfig
0.3 KB
15 May 2023 9.30 PM
root / root
0644
macros.mono-srpm
0.177 KB
15 May 2023 9.30 PM
root / root
0644
macros.nodejs-srpm
0.316 KB
15 May 2023 9.30 PM
root / root
0644
macros.ocaml-srpm
0.72 KB
14 Oct 2019 3.31 PM
root / root
0644
macros.openblas-srpm
0.102 KB
17 Oct 2019 3.47 AM
root / root
0644
macros.perl
5.063 KB
28 Jul 2025 3.01 PM
root / root
0644
macros.perl-srpm
0.775 KB
13 Oct 2019 9.18 PM
root / root
0644
macros.pybytecompile
0.865 KB
16 May 2023 7.55 PM
root / root
0644
macros.python
3.358 KB
16 May 2023 7.55 PM
root / root
0644
macros.python-srpm
5.95 KB
16 May 2023 7.55 PM
root / root
0644
macros.python2
1.819 KB
21 Apr 2022 10.26 PM
root / root
0644
macros.python3
3.627 KB
16 May 2023 7.55 PM
root / root
0644
macros.rust-srpm
0.06 KB
9 Jan 2018 2.15 AM
root / root
0644
macros.scl
13.532 KB
1 Apr 2023 11.10 PM
root / root
0644
macros.selinux-policy
6.607 KB
17 Dec 2024 11.10 AM
root / root
0644
macros.systemd
4.029 KB
5 Nov 2025 4.26 PM
root / root
0644
macros.systemtap
0.201 KB
14 Oct 2023 8.06 PM
root / root
0644
macros.valgrind-srpm
0.124 KB
15 May 2023 9.30 PM
root / root
0644
macros.vim
0.039 KB
12 Oct 2025 7.16 AM
root / root
0644
macros.vpath
0.223 KB
15 May 2023 9.30 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF