Blame SOURCES/macros.python

bae33e
# %%__python is defined in /usr/lib/rpm/macros to raise an error
bae33e
# so if you don't redefine it, you'll get the same error from %%python
bae33e
%python %__python
bae33e
bae33e
%python_platform_triplet %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('MULTIARCH'))")
bae33e
%python_ext_suffix %(%{__python} -Esc "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))")
bae33e
2599dd
%py_setup setup.py
2599dd
%py_shbang_opts -s
2599dd
bae33e
%py_shbang_opts_nodash %(opts=%{py_shbang_opts}; echo ${opts#-})
bae33e
%py_shebang_flags %(opts=%{py_shbang_opts}; echo ${opts#-})
bae33e
%py_shebang_fix %{expand:\\\
bae33e
  if [ -f /usr/bin/pathfix%{python_version}.py ]; then
bae33e
    pathfix=/usr/bin/pathfix%{python_version}.py
bae33e
  else
bae33e
    # unversioned pathfix.py provided by platform-python-devel
bae33e
    pathfix=/usr/bin/pathfix.py
bae33e
  fi
bae33e
  if [ -z "%{?py_shebang_flags}" ]; then
bae33e
    shebang_flags="-k"
bae33e
  else
bae33e
    shebang_flags="-ka%{py_shebang_flags}"
bae33e
  fi
bae33e
  $pathfix -pni %{__python} $shebang_flags}
bae33e
2599dd
# Use the slashes after expand so that the command starts on the same line as
2599dd
# the macro
2599dd
%py_build() %{expand:\\\
2599dd
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
2e4bbb
  %{__python} %{py_setup} %{?py_setup_args} build --executable="%{__python} %{py_shbang_opts}" %{?*}
2599dd
  sleep 1
2599dd
}
2599dd
2599dd
%py_build_egg() %{expand:\\\
2599dd
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
2599dd
  %{__python} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
2599dd
  sleep 1
2599dd
}
2599dd
2599dd
%py_build_wheel() %{expand:\\\
2599dd
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
2599dd
  %{__python} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
2599dd
  sleep 1
2599dd
}
2599dd
2599dd
%py_install() %{expand:\\\
2599dd
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
2599dd
  %{__python} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
2599dd
}
2599dd
2599dd
%py_install_egg() %{expand:\\\
2599dd
  mkdir -p %{buildroot}%{python_sitelib}
2599dd
  easy_install -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python_version}.egg %{?*}
2599dd
}
2599dd
2599dd
%py_install_wheel() %{expand:\\\
2599dd
  pip install -I dist/%{1} --root %{buildroot} --strip-file-prefix %{buildroot} --no-deps
2599dd
}
2599dd
2599dd
%python_provide() %{lua:
2599dd
  function string.starts(String,Start)
2599dd
    return string.sub(String,1,string.len(Start))==Start
2599dd
  end
2599dd
  package = rpm.expand("%{?1}")
2599dd
  vr = rpm.expand("%{?epoch:%{epoch}:}%{version}-%{release}")
2599dd
  if (string.starts(package, "python2-")) then
2599dd
    --No unversioned provides as python2 is not default
2599dd
  elseif (string.starts(package, "python" .. rpm.expand("%{python3_pkgversion}") .. "-")) then
2599dd
    --No unversioned provides as python3 is not default
2599dd
  elseif (rpm.expand("%{?python3_other_pkgversion}") ~= "" and string.starts(package, "python" .. rpm.expand("%{python3_other_pkgversion}") .. "-")) then
2599dd
    --No unversioned provides as python3_other is not default
2599dd
  elseif (string.starts(package, "pypy-")) then
2599dd
    --No unversioned provides as pypy is not default
2599dd
  elseif (string.starts(package, "pypy3-")) then
2599dd
    --No unversioned provides as pypy is not default
2599dd
  elseif (string.starts(package, "python-")) then
2599dd
    --Providing the current default python
2599dd
    print("Provides: python2-")
2599dd
    print(string.sub(package,8,string.len(package)))
2599dd
    print(" = ")
2599dd
    print(vr)
2599dd
  else
2599dd
    print("%python_provide: ERROR: ")
2599dd
    print(package)
2599dd
    print(" not recognized.")
2599dd
  end
2599dd
}
2599dd
2599dd
%python_enable_dependency_generator() \
2599dd
%global __python_requires %{_rpmconfigdir}/pythondistdeps.py --requires \
2599dd
%{nil}