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