1
0

Accepting request 1007481 from devel:languages:python:jupyter

- Remove duplicates workaround

OBS-URL: https://build.opensuse.org/request/show/1007481
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-nbclassic?expand=0&rev=11
This commit is contained in:
Dominique Leuenberger 2022-10-03 11:45:46 +00:00 committed by Git OBS Bridge
commit a64e5f479f
2 changed files with 15 additions and 28 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Sat Oct 1 19:17:58 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Remove duplicates workaround
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Sep 30 15:15:04 UTC 2022 - Arun Persaud <arun@gmx.de> Fri Sep 30 15:15:04 UTC 2022 - Arun Persaud <arun@gmx.de>

View File

@ -24,9 +24,10 @@
%define psuffix %{nil} %define psuffix %{nil}
%bcond_with test %bcond_with test
%endif %endif
%define plainpython python
# this conditional is used in the python-rpm-macros, but `osc build --without libalternatives` won't work # this conditional is used in the python-rpm-macros, but `osc build --without libalternatives` won't work
%bcond_without libalternatives %bcond_without libalternatives
Name: python-nbclassic%{psuffix} Name: python-nbclassic%{psuffix}
Version: 0.4.4 Version: 0.4.4
Release: 0 Release: 0
@ -87,6 +88,7 @@ on top of the new Python server backend.
%package -n jupyter-nbclassic %package -n jupyter-nbclassic
Summary: Jupyter Notebook as a Jupyter Server Extension Summary: Jupyter Notebook as a Jupyter Server Extension
Requires: python3-nbclassic = %{version}
%description -n jupyter-nbclassic %description -n jupyter-nbclassic
NBClassic runs the Jupyter Notebook frontend on the Jupyter Server backend. NBClassic runs the Jupyter Notebook frontend on the Jupyter Server backend.
@ -107,7 +109,10 @@ This package contains the jupyterlab server configuration and desktop files
%if !%{with test} %if !%{with test}
%install %install
%pyproject_install %{SOURCE1} %pyproject_install %{SOURCE1}
%python_clone -a %{buildroot}%{_bindir}/jupyter-nbclassic
%python_clone -a %{buildroot}%{_bindir}/jupyter-nbclassic-bundlerextension
%python_clone -a %{buildroot}%{_bindir}/jupyter-nbclassic-extension
%python_clone -a %{buildroot}%{_bindir}/jupyter-nbclassic-serverextension
%{python_expand # %{python_expand #
rm %{buildroot}%{$python_sitelib}/nbclassic/bundler/tests/resources/subdir/subsubdir/.gitkeep rm %{buildroot}%{$python_sitelib}/nbclassic/bundler/tests/resources/subdir/subsubdir/.gitkeep
@ -129,32 +134,6 @@ sed -E '
' >> %{$python_prefix}-nbclassic.files < lang-dirs ' >> %{$python_prefix}-nbclassic.files < lang-dirs
} }
# https://github.com/jupyter/notebook/issues/6501
cp %{buildroot}%{_bindir}/jupyter-nbclassic %{buildroot}%{_bindir}/jupyter-notebook
# clone after copy to jupyter-notebook
%python_clone -a %{buildroot}%{_bindir}/jupyter-nbclassic
duplicates="jupyter-notebook jupyter-nbclassic-bundlerextension jupyter-nbclassic-extension jupyter-nbclassic-serverextension"
for basebin in $duplicates; do
%python_clone -a %{buildroot}%{_bindir}/${basebin}
%{python_expand mv %{buildroot}%{_bindir}/${basebin}{,.nbclassic}-%{$python_bin_suffix}
echo %{_bindir}/${basebin} >> %{$python_prefix}-nbclassic.files
echo %{_bindir}/${basebin}.nbclassic-%{$python_bin_suffix} >> %{$python_prefix}-nbclassic.files
echo "%%dir %{_datadir}/libalternatives/${basebin}" >> %{$python_prefix}-nbclassic.files
# increase priority over alternatives from notebook and use same grouping
myaltprio=%{$python_version_nodots}
if [ "%{$python_provides}" == "python3" ]; then
myaltprio=$(($myaltprio + 1000))
fi
conf=%{buildroot}%{_datadir}/libalternatives/${basebin}/${myaltprio}.conf
newconf=${conf/.conf/0.conf}
sed "s/${basebin}/${basebin}.nbclassic/" $conf > $newconf
echo "group=${duplicates// /, }" >> $newconf
rm $conf
echo $newconf | sed 's:%{buildroot}::' >> %{$python_prefix}-nbclassic.files
}
done
%fdupes %{buildroot}%{_bindir}
%suse_update_desktop_file jupyter-nbclassic %suse_update_desktop_file jupyter-nbclassic
%endif %endif
@ -172,6 +151,9 @@ done
%doc README.md %doc README.md
%license LICENSE %license LICENSE
%python_alternative %{_bindir}/jupyter-nbclassic %python_alternative %{_bindir}/jupyter-nbclassic
%python_alternative %{_bindir}/jupyter-nbclassic-bundlerextension
%python_alternative %{_bindir}/jupyter-nbclassic-extension
%python_alternative %{_bindir}/jupyter-nbclassic-serverextension
%{python_sitelib}/nbclassic-%{version}*-info %{python_sitelib}/nbclassic-%{version}*-info
%files -n jupyter-nbclassic %files -n jupyter-nbclassic