Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make "shaptools" available inside the Salt Bundle (venv-salt-minion) (bsc#1212695) #76

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<param name="scm">git</param>
<param name="exclude">.git</param>
<param name="filename">python-shaptools</param>
<param name="versionformat">0.3.13+git.%ct.%h</param>
<param name="versionformat">0.3.14+git.%ct.%h</param>
<param name="revision">%%VERSION%%</param>
</service>

Expand Down
6 changes: 6 additions & 0 deletions python-shaptools.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Nov 21 11:22:48 UTC 2023 - Pablo Suárez Hernández <[email protected]>

- Create version 0.3.14
- Make shaptools available for venv-salt-minion (bsc#1212695)

-------------------------------------------------------------------
Fri Jan 13 02:13:36 UTC 2023 - Steve Kowalik <[email protected]>

Expand Down
36 changes: 36 additions & 0 deletions python-shaptools.spec
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ BuildArch: noarch
%description
API to expose SAP HANA functionalities

%package -n python3-shaptools-venv-salt-minion
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see python3 used always. What if we need the py2 version?
Or is it irrelevant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the "venv-salt-minion" package is only Python 3.

Are you supporting shap based formulas on Python 2 OSes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were when I implemented this package 5 years ago. Right now, I'm not really sure to be honest

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also simply not support the py2 version use case in the "venv-salt-minion" use case.
Maybe a simple %if %{without python2} condition could be wrapped around the sub-package?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the notes 👍

So Salt Bundle is only Python 3, and from what I can see, formulas like "saphanabootstrap" are installing python3-shaptools depending on the pythonversion that is processing the Salt formula: https://github.com/SUSE/saphanabootstrap-formula/blob/main/hana/packages.sls#L32

Therefore if Salt Bundle is the one processing the formula, which is always Python 3, then the "python3-shaptools" package will be installed and, due to this PR, the new python3-shaptools-venv-salt-minion package will get automatically installed. We are all fine here.

It doesn't really make to have a python 2 flavor of this integration with the Salt Bundle.

I would also simply not support the py2 version use case in the "venv-salt-minion" use case. Maybe a simple %if %{without python2} condition could be wrapped around the sub-package?

Agree as mentioned. It doesn't make sense a Python 2 flavor for the "venv-salt-minion".

IIUC the %if %{without python2} is not really needed here - we always want to build the python3-shaptools-venv-salt-minion package, AFAICS the "python-shaptools" always build python3 subpackages and for some OSes it additionally builds the python2 flavor.

Summary: Shaptools integration with Salt Bundle
Group: Development/Languages/Python
Requires: venv-salt-minion
Requires: python3-shaptools
Supplements: packageand(python3-shaptools:venv-salt-minion)
BuildArch: noarch

%description -n python3-shaptools-venv-salt-minion
Integration of shaptools library inside the Salt Bundle, aka venv-salt-minion.

%prep
%setup -q -n %{name}-%{version}

Expand All @@ -71,6 +82,29 @@ API to expose SAP HANA functionalities
%postun
%python_uninstall_alternative shapcli

%post -n python3-shaptools-venv-salt-minion
BUNDLE_SITELIB=
if [ -f /usr/lib/venv-salt-minion/bin/python ]
then
BUNDLE_SITELIB=`/usr/lib/venv-salt-minion/bin/python -c "import sysconfig as s; print(s.get_paths().get('purelib'))"`
fi
if [ ! -z "$BUNDLE_SITELIB" ] && [ -d "%{python_sitelib}/shaptools" ] && [ ! -f "$BUNDLE_SITELIB/shaptools" ]
then
ln -s %{python_sitelib}/shaptools/ $BUNDLE_SITELIB/shaptools
fi

%postun -n python3-shaptools-venv-salt-minion
BUNDLE_SITELIB=
if [ -f /usr/lib/venv-salt-minion/bin/python ]
then
BUNDLE_SITELIB=`/usr/lib/venv-salt-minion/bin/python -c "import sysconfig as s; print(s.get_paths().get('purelib'))"`
fi
if [ ! -z "$BUNDLE_SITELIB" ] && [ -L "$BUNDLE_SITELIB/shaptools" ]
then
rm $BUNDLE_SITELIB/shaptools
fi


%if %{with test}
%check
%pytest tests
Expand All @@ -86,4 +120,6 @@ API to expose SAP HANA functionalities
%{python_sitelib}/*
%python_alternative %{_bindir}/shapcli

%files -n python3-shaptools-venv-salt-minion

%changelog
2 changes: 1 addition & 1 deletion shaptools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
:since: 2018-11-15
"""

__version__ = "0.3.13"
__version__ = "0.3.14"
Loading