132 |
- |
1 |
# python3_pkgversion specifies the version of Python 3 in the distro. It can be
|
|
|
2 |
# a specific version (e.g. 34 in Fedora EPEL7)
|
|
|
3 |
%python3_pkgversion 34
|
|
|
4 |
#python3_other_pkgversion 35
|
|
|
5 |
|
|
|
6 |
# Set to /bin/true when not active to avoid %ifdefs and %{? in specfiles
|
|
|
7 |
%__python3_other /bin/true
|
|
|
8 |
%py3_other_build /bin/true
|
|
|
9 |
%py3_other_install /bin/true
|
|
|
10 |
|
|
|
11 |
# Macro to replace overly complicated references to PyPI source files.
|
|
|
12 |
# Expands to the pythonhosted URL for a package
|
|
|
13 |
# Accepts zero to three arguments:
|
|
|
14 |
# 1: The PyPI project name, defaulting to %srcname if it is defined, then
|
|
|
15 |
# %pypi_name if it is defined, then just %name.
|
|
|
16 |
# 2: The PYPI version, defaulting to %version.
|
|
|
17 |
# 3: The file extension, defaulting to "tar.gz". (A period will be added
|
|
|
18 |
# automatically.)
|
|
|
19 |
# Requires %__pypi_url and %__pypi_default_extension to be defined.
|
|
|
20 |
%__pypi_url https://files.pythonhosted.org/packages/source/
|
|
|
21 |
%__pypi_default_extension tar.gz
|
|
|
22 |
|
|
|
23 |
%pypi_source() %{lua:
|
|
|
24 |
local src = rpm.expand('%1')
|
|
|
25 |
local ver = rpm.expand('%2')
|
|
|
26 |
local ext = rpm.expand('%3')
|
|
|
27 |
local url = rpm.expand('%__pypi_url')
|
|
|
28 |
\
|
|
|
29 |
-- If no first argument, try %srcname, then %pypi_name, then %name
|
|
|
30 |
-- Note that rpm leaves macros unchanged if they are not defined.
|
|
|
31 |
if src == '%1' then
|
|
|
32 |
src = rpm.expand('%srcname')
|
|
|
33 |
end
|
|
|
34 |
if src == '%srcname' then
|
|
|
35 |
src = rpm.expand('%pypi_name')
|
|
|
36 |
end
|
|
|
37 |
if src == '%pypi_name' then
|
|
|
38 |
src = rpm.expand('%name')
|
|
|
39 |
end
|
|
|
40 |
\
|
|
|
41 |
-- If no second argument, use %version
|
|
|
42 |
if ver == '%2' then
|
|
|
43 |
ver = rpm.expand('%version')
|
|
|
44 |
end
|
|
|
45 |
\
|
|
|
46 |
-- If no third argument, use the preset default extension
|
|
|
47 |
if ext == '%3' then
|
|
|
48 |
ext = rpm.expand('%__pypi_default_extension')
|
|
|
49 |
end
|
|
|
50 |
\
|
|
|
51 |
local first = string.sub(src, 1, 1)
|
|
|
52 |
\
|
|
|
53 |
print(url .. first .. '/' .. src .. '/' .. src .. '-' .. ver .. '.' .. ext)
|
|
|
54 |
}
|