Skip to content

Commit

Permalink
Merge pull request #715 from StackStorm/el8_py38
Browse files Browse the repository at this point in the history
  • Loading branch information
amanda11 authored Mar 15, 2022
2 parents 8eb9ac3 + 626d88e commit 75a0e5e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 14 deletions.
6 changes: 3 additions & 3 deletions packages/st2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ else ifeq ($(DEB_DISTRO),focal)
PYTHON_BINARY := /usr/bin/python3
PIP_BINARY := /usr/local/bin/pip3.8
else ifeq ($(EL_VERSION),8)
PYTHON_BINARY := /usr/bin/python3
PIP_BINARY := /usr/local/bin/pip3
PYTHON_ALT_BINARY := python3
PYTHON_BINARY := /usr/bin/python3.8
PIP_BINARY := /usr/local/bin/pip3.8
PYTHON_ALT_BINARY := python3.8
else ifeq ($(EL_VERSION),7)
PYTHON_BINARY := /usr/bin/python3
PIP_BINARY := /usr/local/bin/pip3
Expand Down
4 changes: 2 additions & 2 deletions packages/st2/component.makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ else ifeq ($(DEB_DISTRO),focal)
PYTHON_BINARY := /usr/bin/python3
PIP_BINARY := /usr/local/bin/pip3.8
else ifeq ($(EL_VERSION),8)
PYTHON_BINARY := /usr/bin/python3
PIP_BINARY := /usr/local/bin/pip3
PYTHON_BINARY := /usr/bin/python3.8
PIP_BINARY := /usr/local/bin/pip3.8
else ifeq ($(EL_VERSION),7)
PYTHON_BINARY := /usr/bin/python3
PIP_BINARY := /usr/local/bin/pip3
Expand Down
13 changes: 9 additions & 4 deletions packages/st2/rpm/st2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ Epoch: %{epoch}
%global _build_id_links none
%endif

Requires: python3-devel, openssl-devel, libffi-devel, git, pam, openssh-server, openssh-clients, bash, setup
Requires: openssl-devel, libffi-devel, git, pam, openssh-server, openssh-clients, bash, setup
%if 0%{?rhel} == 8
Requires: python38-devel
%else # Requires for RHEL 8
Requires: python3-devel
%endif # Requires for RHEL 7

# EL8 requires a few python packages available within 'BUILDROOT' when outside venv
# These are in the el8 packagingbuild dockerfile
# Reference https://fossies.org/linux/ansible/packaging/rpm/ansible.spec
%if 0%{?rhel} == 8
# Will use the python3 stdlib venv
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif # Requires for RHEL 8
BuildRequires: python38-devel
BuildRequires: python38-setuptools
%endif # Requires for RHEL 7

%if 0%{?rhel} == 8
# By default on EL 8, RPM helper scripts will try to generate Requires: section which lists every
Expand Down
4 changes: 4 additions & 0 deletions rpmspec/helpers.spec
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
# if package name starts with st2 then it's st2 component.
#
%if %(PKG=%{package}; [ "${PKG##st2}" != "$PKG" ] && echo 1 || echo 0 ) == 1
%if 0%{?rhel} == 8
%define st2pkg_version %(python3.8 -c "from %{package} import __version__; print(__version__),")
%else
%define st2pkg_version %(python3 -c "from %{package} import __version__; print(__version__),")
%endif
%endif # st2 package version parsing


Expand Down
18 changes: 13 additions & 5 deletions rpmspec/package_venv.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@
%define venv_dir %{buildroot}/%{venv_install_dir}
%define venv_bin %{venv_dir}/bin

%define venv_python %{venv_bin}/python3
%if 0%{?rhel} == 8
%define python_binname python3.8
%define pip_binname pip3.8
%else
%define python_binname python3
%define pip_binname pip3
%endif

%define venv_python %{venv_bin}/%{python_binname}
# https://github.com/StackStorm/st2/wiki/Where-all-to-update-pip-and-or-virtualenv
%define pin_pip %{venv_python} %{venv_bin}/pip3 install pip==20.3.3
%define install_venvctrl python3 -m pip install venvctrl
%define pin_pip %{venv_python} %{venv_bin}/%{pip_binname} install pip==20.3.3
%define install_venvctrl %{python_binname} -m pip install venvctrl
%if 0%{?rhel} == 8
%define install_crypto %{venv_python} %{venv_bin}/pip install cryptography==2.8
%define install_crypto %{venv_python} %{venv_bin}/pip3.8 install cryptography==2.8
%else
%define install_crypto %{nil}
%endif
Expand All @@ -25,7 +33,7 @@

# EL8 requires crypto built locally and venvctrl available outside of venv
%define pip_install_venv \
virtualenv-3 -p python3 --no-download %{venv_dir} \
virtualenv-3 -p %{python_binname} --no-download %{venv_dir} \
%{pin_pip} \
%{install_crypto} \
%{venv_pip} --use-deprecated=legacy-resolver -r requirements.txt \
Expand Down

0 comments on commit 75a0e5e

Please sign in to comment.