1
0

Accepting request 931208 from devel:languages:python:jupyter

- Update to 4.9.1
  * Add Python site user base subdirectories to config and data
    user-level paths if site.ENABLE_USER_SITE is True. One way to
    disable these directory additions is to set the
    PYTHONNOUSERSITE environment variable. These locations can be
    customized by setting the PYTHONUSERBASE environment variable.
  * Add a workaround for virtualenv for getting the user site
    directory.
- Patch for solving gh#openSUSE/libalternatives#11:
  argv0_subcommand.patch
  This patch can be removed while releasing version >4.9.1.
- Enabled using libalternatives again.

OBS-URL: https://build.opensuse.org/request/show/931208
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-jupyter-core?expand=0&rev=9
This commit is contained in:
Dominique Leuenberger 2021-11-15 14:26:11 +00:00 committed by Git OBS Bridge
commit 605c7c557d
5 changed files with 71 additions and 9 deletions

43
argv0_subcommand.patch Normal file
View File

@ -0,0 +1,43 @@
diff -Naur org/jupyter_core/command.py patch/jupyter_core/command.py
--- org/jupyter_core/command.py 2021-11-12 09:01:30.121064192 +0100
+++ patch/jupyter_core/command.py 2021-11-12 09:07:57.943564964 +0100
@@ -297,7 +297,7 @@
sys.exit(e)
try:
- _execvp(command, sys.argv[1:])
+ _execvp(command, [command] + sys.argv[2:])
except OSError as e:
sys.exit("Error executing Jupyter command %r: %s" % (subcommand, e))
diff -Naur org/jupyter_core/tests/test_command.py patch/jupyter_core/tests/test_command.py
--- org/jupyter_core/tests/test_command.py 2021-11-12 09:01:59.721265505 +0100
+++ patch/jupyter_core/tests/test_command.py 2021-11-12 09:09:21.832084810 +0100
@@ -192,3 +192,27 @@
env[str('PATHEXT')] = '.EXE'
out = check_output([sys.executable, str(jupyter), 'witness'], env=env)
assert b'WITNESS A' in out
+
+def test_argv0(tmpdir):
+ a = tmpdir.mkdir("a")
+ jupyter = a.join('jupyter')
+ jupyter.write(
+ 'from jupyter_core import command; command.main()'
+ )
+ jupyter.chmod(0o700)
+ witness_a = a.join('jupyter-witness')
+ witness_a_src = f'''#!{sys.executable}
+import sys
+print(sys.argv[0])
+'''
+ write_executable(witness_a, witness_a_src)
+
+ env = {}
+ if 'SYSTEMROOT' in os.environ: # Windows http://bugs.python.org/issue20614
+ env[str('SYSTEMROOT')] = os.environ['SYSTEMROOT']
+ if sys.platform == 'win32':
+ env[str('PATHEXT')] = '.EXE'
+ out = check_output([sys.executable, str(jupyter), 'witness'], env=env)
+
+ # Make sure the first argv is the full path to the executing script
+ assert f'{jupyter}-witness'.encode() in out

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ef210dcb4fca04de07f2ead4adf408776aca94d17151d6f750ad6ded0b91ea16
size 73579

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dce8a7499da5a53ae3afd5a9f4b02e5df1d57250cf48f3ad79da23b4778cd6fa
size 74787

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Fri Nov 12 21:09:24 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Update to 4.9.1
* Add Python site user base subdirectories to config and data
user-level paths if site.ENABLE_USER_SITE is True. One way to
disable these directory additions is to set the
PYTHONNOUSERSITE environment variable. These locations can be
customized by setting the PYTHONUSERBASE environment variable.
* Add a workaround for virtualenv for getting the user site
directory.
-------------------------------------------------------------------
Fri Nov 12 08:25:01 UTC 2021 - Stefan Schubert <schubi@suse.de>
- Patch for solving gh#openSUSE/libalternatives#11:
argv0_subcommand.patch
This patch can be removed while releasing version >4.9.1.
- Enabled using libalternatives again.
-------------------------------------------------------------------
Thu Oct 28 19:16:16 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@ -17,8 +17,7 @@
#
%bcond_with libalternatives_issue_11_fixed
%if 0%{?suse_version} > 1500 && %{with libalternatives_issue_11_fixed}
%if 0%{?suse_version} > 1500
%bcond_without libalternatives
%else
%bcond_with libalternatives
@ -35,7 +34,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-jupyter-core%{psuffix}
Version: 4.8.1
Version: 4.9.1
Release: 0
Summary: Base package on which Jupyter projects rely
License: BSD-3-Clause
@ -43,6 +42,8 @@ URL: https://github.com/jupyter/jupyter_core
Source0: https://files.pythonhosted.org/packages/source/j/jupyter_core/jupyter_core-%{version}.tar.gz
# PATCH-FIX-OPENSUSE -- use_rpms_paths.patch -- change paths so they are easy to replace at build time
Patch0: use_rpms_paths.patch
# PATCH-FIX-UPSTREAM argv0_subcommand.patch -- gh#jupyter/jupyter_core#248, merged after the release of 4.9.1
Patch1: argv0_subcommand.patch
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module traitlets}
BuildRequires: fdupes
@ -84,8 +85,7 @@ There is no reason to install this package on its own. It will be pulled in
as a dependency by packages that require it.
%prep
%setup -q -n jupyter_core-%{version}
%patch0 -p1
%autosetup -p1 -n jupyter_core-%{version}
# Set the appropriate hardcoded paths dynamically
sed -i "s|\"_datadir_jupyter_\"|\"%{_datadir}/jupyter\"|" jupyter_core/paths.py
sed -i "s|\"_sysconfdir_jupyter_\"|\"%{_sysconfdir}/jupyter\"|" jupyter_core/paths.py
@ -115,7 +115,6 @@ popd
%endif
%pre
# removing old update-alternatives entries
# If libalternatives is used: Removing old update-alternatives entries.
%python_libalternatives_reset_alternative jupyter