| 1 | %py_setup setup.py | 
|---|
| 2 | %py_shbang_opts -s | 
|---|
| 3 |  | 
|---|
| 4 | # Use the slashes after expand so that the command starts on the same line as | 
|---|
| 5 | # the macro | 
|---|
| 6 | %py_build() %{expand:\\\ | 
|---|
| 7 | CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py_shbang_opts}" %{?*} | 
|---|
| 8 | sleep 1 | 
|---|
| 9 | } | 
|---|
| 10 |  | 
|---|
| 11 | %py_build_egg() %{expand:\\\ | 
|---|
| 12 | CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*} | 
|---|
| 13 | sleep 1 | 
|---|
| 14 | } | 
|---|
| 15 |  | 
|---|
| 16 | %py_build_wheel() %{expand:\\\ | 
|---|
| 17 | CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*} | 
|---|
| 18 | sleep 1 | 
|---|
| 19 | } | 
|---|
| 20 |  | 
|---|
| 21 | %py_install() %{expand:\\\ | 
|---|
| 22 | CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*} | 
|---|
| 23 | } | 
|---|
| 24 |  | 
|---|
| 25 | %py_install_egg() %{expand:\\\ | 
|---|
| 26 | mkdir -p %{buildroot}%{python_sitelib} | 
|---|
| 27 | easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*} | 
|---|
| 28 | } | 
|---|
| 29 |  | 
|---|
| 30 | %py_install_wheel() %{expand:\\\ | 
|---|
| 31 | pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps | 
|---|
| 32 | } | 
|---|
| 33 |  | 
|---|
| 34 | %python_provide() %{lua: | 
|---|
| 35 | function string.starts(String,Start) | 
|---|
| 36 | return string.sub(String,1,string.len(Start))==Start | 
|---|
| 37 | end | 
|---|
| 38 | package = rpm.expand("%{?1}") | 
|---|
| 39 | vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}") | 
|---|
| 40 | if (string.starts(package, "python2-")) then | 
|---|
| 41 | if (rpm.expand("%{?buildarch}") ~= "noarch") then | 
|---|
| 42 | str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr | 
|---|
| 43 | print(rpm.expand(str)) | 
|---|
| 44 | end | 
|---|
| 45 | print("\\nProvides: python-") | 
|---|
| 46 | print(string.sub(package,9,string.len(package))) | 
|---|
| 47 | print(" = ") | 
|---|
| 48 | print(vr) | 
|---|
| 49 | --Obsoleting the previous default python package | 
|---|
| 50 | print("\\nObsoletes: python-") | 
|---|
| 51 | print(string.sub(package,9,string.len(package))) | 
|---|
| 52 | print(" < ") | 
|---|
| 53 | print(vr) | 
|---|
| 54 | elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then | 
|---|
| 55 | --No unversioned provides as python3 is not default | 
|---|
| 56 | elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then | 
|---|
| 57 | --No unversioned provides as python3_other is not default | 
|---|
| 58 | elseif (string.starts(package, "pypy-")) then | 
|---|
| 59 | --No unversioned provides as pypy is not default | 
|---|
| 60 | elseif (string.starts(package, "pypy3-")) then | 
|---|
| 61 | --No unversioned provides as pypy is not default | 
|---|
| 62 | elseif (string.starts(package, "python-")) then | 
|---|
| 63 | --Providing the current default python | 
|---|
| 64 | print("Provides: python2-") | 
|---|
| 65 | print(string.sub(package,8,string.len(package))) | 
|---|
| 66 | print(" = ") | 
|---|
| 67 | print(vr) | 
|---|
| 68 | else | 
|---|
| 69 | print("%python_provide: ERROR: ") | 
|---|
| 70 | print(package) | 
|---|
| 71 | print(" not recognized.") | 
|---|
| 72 | end | 
|---|
| 73 | } | 
|---|