8d3d1dd
%python2_sitelib %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
8d3d1dd
%python2_sitearch %(%{__python2} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
8d3d1dd
%python2_version %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))")
8d3d1dd
%python2_version_nodots %(%{__python2} -Esc "import sys; sys.stdout.write('{0.major}{0.minor}'.format(sys.version_info))")
0086612
%python2_platform %(%{__python2} -Esc "import sysconfig; print(sysconfig.get_platform())")
Orion Poplawski ec28c77
Orion Poplawski ec28c77
%py2_shbang_opts -s
e9f07b7
%py2_shbang_opts_nodash %(opts=%{py2_shbang_opts}; echo ${opts#-})
7237192
%py2_shebang_flags %(opts=%{py2_shbang_opts}; echo ${opts#-})
e5429a7
%py2_shebang_fix %{expand:\\\
e5429a7
  if [ -z "%{?py_shebang_flags}" ]; then
e5429a7
    shebang_flags="-k"
e5429a7
  else
e5429a7
    shebang_flags="-ka%{py2_shebang_flags}"
e5429a7
  fi
e5429a7
  /usr/bin/pathfix.py -pni %{__python2} $shebang_flags}
Orion Poplawski ec28c77
Orion Poplawski 5ca1f52
# Use the slashes after expand so that the command starts on the same line as
Orion Poplawski 5ca1f52
# the macro
c8932dc
# The `sleep 1` commands work around a race in install; see:
c8932dc
#   https://bugzilla.redhat.com/show_bug.cgi?id=1644923
Orion Poplawski 5ca1f52
%py2_build() %{expand:\\\
c8932dc
  sleep 1
4904408
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
4904408
  %{__python2} %{py_setup} %{?py_setup_args} build --executable="%{__python2} %{py2_shbang_opts}" %{?*}
Orion Poplawski 29e6636
  sleep 1
Orion Poplawski ec28c77
}
Orion Poplawski ec28c77
Orion Poplawski 5ca1f52
%py2_build_egg() %{expand:\\\
c8932dc
  sleep 1
4904408
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
4904408
  %{__python2} %{py_setup} %{?py_setup_args} bdist_egg %{?*}
Orion Poplawski e7af332
  sleep 1
Orion Poplawski e7af332
}
Orion Poplawski e7af332
Orion Poplawski 5ca1f52
%py2_build_wheel() %{expand:\\\
c8932dc
  sleep 1
4904408
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
4904408
  %{__python2} %{py_setup} %{?py_setup_args} bdist_wheel %{?*}
Orion Poplawski f798c43
  sleep 1
Orion Poplawski f798c43
}
Orion Poplawski f798c43
Orion Poplawski 5ca1f52
%py2_install() %{expand:\\\
4904408
  CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\\\
4904408
  %{__python2} %{py_setup} %{?py_setup_args} install -O1 --skip-build --root %{buildroot} %{?*}
2314fd9
  rm -rfv %{buildroot}%{_bindir}/__pycache__
Orion Poplawski ec28c77
}
Orion Poplawski f798c43
Orion Poplawski 5ca1f52
%py2_install_egg() %{expand:\\\
Orion Poplawski f798c43
  mkdir -p %{buildroot}%{python2_sitelib}
69b1b30
  %{__python2} -m easy_install  -m --prefix %{buildroot}%{_prefix} -Z dist/*-py%{python2_version}.egg %{?*}
2314fd9
  rm -rfv %{buildroot}%{_bindir}/__pycache__
Orion Poplawski f798c43
}
Orion Poplawski e7af332
Orion Poplawski 5ca1f52
%py2_install_wheel() %{expand:\\\
06ee391
  %{__python2} -m pip install -I dist/%{1} --root %{buildroot} --no-deps --no-index --no-warn-script-location
2314fd9
  rm -rfv %{buildroot}%{_bindir}/__pycache__
daf7d32
  for distinfo in %{buildroot}%{python2_sitelib}/*.dist-info %{buildroot}%{python2_sitearch}/*.dist-info; do
daf7d32
    if [ -f ${distinfo}/direct_url.json ]; then
daf7d32
      rm -fv ${distinfo}/direct_url.json
daf7d32
      sed -i '/direct_url.json/d' ${distinfo}/RECORD
daf7d32
    fi
daf7d32
  done
Orion Poplawski e7af332
}