f245b7
%py_setup setup.py
f245b7
%py_shbang_opts -s
f245b7
f245b7
# Use the slashes after expand so that the command starts on the same line as
f245b7
# the macro
f245b7
%py_build() %{expand:\\\
4c5d06
  CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python} %{py_shbang_opts}" %{?*}
f245b7
  sleep 1
f245b7
}
f245b7
f245b7
%py_build_egg() %{expand:\\\
f245b7
  CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
f245b7
  sleep 1
f245b7
}
f245b7
f245b7
%py_build_wheel() %{expand:\\\
f245b7
  CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
f245b7
  sleep 1
f245b7
}
f245b7
f245b7
%py_install() %{expand:\\\
f245b7
  CFLAGS="%{optflags}" %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
f245b7
}
f245b7
f245b7
%py_install_egg() %{expand:\\\
f245b7
  mkdir -p %{buildroot}%{python_sitelib}
f245b7
  easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*}
f245b7
}
f245b7
f245b7
%py_install_wheel() %{expand:\\\
f245b7
  pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
f245b7
}
f245b7
f245b7
%python_provide() %{lua:
f245b7
  function string.starts(String,Start)
f245b7
    return string.sub(String,1,string.len(Start))==Start
f245b7
  end
f245b7
  package = rpm.expand("%{?1}")
f245b7
  vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
f245b7
  if (string.starts(package, "python2-")) then
f245b7
    if (rpm.expand("%{?buildarch}") ~= "noarch") then
f245b7
      str = "Provides: python-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr
f245b7
      print(rpm.expand(str))
f245b7
    end
f245b7
    print("\\nProvides: python-")
f245b7
    print(string.sub(package,9,string.len(package)))
f245b7
    print(" = ")
f245b7
    print(vr)
f245b7
    --Obsoleting the previous default python package
f245b7
    print("\\nObsoletes: python-")
f245b7
    print(string.sub(package,9,string.len(package)))
f245b7
    print(" < ")
f245b7
    print(vr)
f245b7
  elseif (string.starts(package, "python3-")) then
f245b7
    if (rpm.expand("%{?buildarch}") ~= "noarch") then
f245b7
      str = "Provides: python36-" .. string.sub(package,9,string.len(package)) .. "%{?_isa} = " .. vr
f245b7
      print(rpm.expand(str))
f245b7
    end
f245b7
    print("\\nProvides: python36-")
f245b7
    print(string.sub(package,9,string.len(package)))
f245b7
    print(" = ")
f245b7
    print(vr)
f245b7
    --Obsoleting the EPEL python36 package
f245b7
    print("\\nObsoletes: python36-")
f245b7
    print(string.sub(package,9,string.len(package)))
f245b7
    print(" < ")
f245b7
    print(vr)
f245b7
  elseif (string.starts(package, "python36-")) then
f245b7
    if (rpm.expand("%{?buildarch}") ~= "noarch") then
f245b7
      str = "Provides: python3-" .. string.sub(package,10,string.len(package)) .. "%{?_isa} = " .. vr
f245b7
      print(rpm.expand(str))
f245b7
    end
f245b7
    print("\\nProvides: python3-")
f245b7
    print(string.sub(package,10,string.len(package)))
f245b7
    print(" = ")
f245b7
    print(vr)
f245b7
  elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then
f245b7
    --No unversioned provides as python3_other is not default
f245b7
  elseif (string.starts(package, "pypy-")) then
f245b7
    --No unversioned provides as pypy is not default
f245b7
  elseif (string.starts(package, "pypy3-")) then
f245b7
    --No unversioned provides as pypy is not default
f245b7
  elseif (string.starts(package, "python-")) then
f245b7
    --Providing the current default python
f245b7
    print("Provides: python2-")
f245b7
    print(string.sub(package,8,string.len(package)))
f245b7
    print(" = ")
f245b7
    print(vr)
f245b7
  else
f245b7
    print("%python_provide: ERROR: ")
f245b7
    print(package)
f245b7
    print(" not recognized.")
f245b7
  end
f245b7
}