Blame SOURCES/macros.python

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