Blame SOURCES/macros.python

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