Accepting request 903093 from home:bnavigator:branches:devel:languages:python

new requirement for upcoming ipykernel 6

OBS-URL: https://build.opensuse.org/request/show/903093
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-debugpy?expand=0&rev=1
This commit is contained in:
Matej Cepl 2021-06-29 20:54:00 +00:00 committed by Git OBS Bridge
commit 6cfc94a4cb
7 changed files with 213 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

3
debugpy-1.3.0.tar.gz Normal file
View File

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

View File

@ -0,0 +1,45 @@
Index: debugpy-1.3.0/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py
===================================================================
--- debugpy-1.3.0.orig/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py
+++ debugpy-1.3.0/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/add_code_to_python_process.py
@@ -271,27 +271,15 @@ def run_python_code_linux(pid, python_co
assert '\'' not in python_code, 'Having a single quote messes with our command.'
filedir = os.path.dirname(__file__)
- # Valid arguments for arch are i386, i386:x86-64, i386:x64-32, i8086,
- # i386:intel, i386:x86-64:intel, i386:x64-32:intel, i386:nacl,
- # i386:x86-64:nacl, i386:x64-32:nacl, auto.
-
- if is_python_64bit():
- suffix = 'amd64'
- arch = 'i386:x86-64'
- else:
- suffix = 'x86'
- arch = 'i386'
-
- print('Attaching with arch: %s' % (arch,))
-
- target_dll = os.path.join(filedir, 'attach_linux_%s.so' % suffix)
+ # must be compiled on the same architecture
+ target_dll = os.path.join(filedir, 'attach_SUSE.so')
target_dll = os.path.abspath(os.path.normpath(target_dll))
+ print('Attaching with lib: %s' % target_dll)
if not os.path.exists(target_dll):
- raise RuntimeError('Could not find dll file to inject: %s' % target_dll)
+ raise RuntimeError('Could not find library to inject: %s' % target_dll)
# Note: we currently don't support debug builds
is_debug = 0
- # Note that the space in the beginning of each line in the multi-line is important!
cmd = [
'gdb',
'--nw', # no gui interface
@@ -306,7 +294,7 @@ def run_python_code_linux(pid, python_co
cmd.extend(["--eval-command='set scheduler-locking off'"]) # If on we'll deadlock.
- cmd.extend(["--eval-command='set architecture %s'" % arch])
+ cmd.extend(["--eval-command='set architecture auto'"])
cmd.extend([
"--eval-command='call (void*)dlopen(\"%s\", 2)'" % target_dll,

16
python-debugpy.changes Normal file
View File

@ -0,0 +1,16 @@
-------------------------------------------------------------------
Tue Jun 29 13:04:38 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Update to 1.3.0
* no release notes.
- new requirement for ipykernel 6
- enable testsuite (multibuild)
- defer debundling pydevd
- add pydevd-openSUSE-attach-autoarch.patch for support of
non-intel architectures when injecting the debug library
- skip python36 in order to save resources
-------------------------------------------------------------------
Fri Dec 4 14:41:13 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Initial packaging of debugpy 1.2.0

122
python-debugpy.spec Normal file
View File

@ -0,0 +1,122 @@
#
# spec file for package python-debugpy
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
# multibuild: some tests fail to find modules in a custom PYTHONPATH, test installed instead
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
# Python 3.6 is officially supported, but debugpy is in openSUSE for ipykernel 6 which is for Python >= 3.7.
# Skip Py36 in order to save resources.
%define skip_python36 1
%define modname debugpy
Name: python-%{modname}%{psuffix}
Version: 1.3.0
Release: 0
Summary: An implementation of the Debug Adapter Protocol for Python
License: MIT
URL: https://github.com/microsoft/debugpy/
Source: https://github.com/microsoft/%{modname}/archive/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE pydevd-openSUSE-attach-autoarch.patch -- support more than intel: use rpmbuild compiled attach library and let gdb figure out the architecture automatically. code@bnavigator.de
Patch0: pydevd-openSUSE-attach-autoarch.patch
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: python-rpm-macros
%if %{with test}
BuildRequires: %{python_module %{modname} = %{version}}
BuildRequires: %{python_module Django}
BuildRequires: %{python_module Flask}
BuildRequires: %{python_module gevent}
BuildRequires: %{python_module psutil}
BuildRequires: %{python_module pytest-timeout}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests}
BuildRequires: gdb
%endif
%python_subpackages
%description
debugpy is an implementation of the Debug Adapter Protocol for Python.
%prep
%autosetup -p1 -n %{modname}-%{version}
# don't remove vendored pydevd until it is packaged as a separate package (which is not upstream's intention)
# rm -rv src/debugpy/_vendored
# remove precompiled libs
rm src/debugpy/_vendored/pydevd/pydevd_attach_to_process/*.{so,dll,dylib,exe,pdb}
# remove script interpreter lines
sed -i '1 {/^#!/ d}' \
src/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/*/*.py \
src/debugpy/_vendored/pydevd/_pydevd_frame_eval/vendored/bytecode/tests/sanitytest.py
# remove gitignore file
find src/debugpy/_vendored/pydevd/ -name .gitignore -delete
%build
%if ! %{with test}
export CFLAGS='%{optflags}'
cp -r src/debugpy/_vendored src/debugpy/_vendored_clean
%{python_expand # cythonize and the attach library are compile in-place
# TODO: find out how to do it not-in-place
rm -r src/debugpy/_vendored
cp -r src/debugpy/_vendored_clean src/debugpy/_vendored
pushd src/debugpy/_vendored/pydevd/pydevd_attach_to_process/linux_and_mac/
g++ %{optflags} -shared -o ../attach_SUSE.so -fPIC -nostartfiles attach.cpp
popd
%{$python_build}
}
%endif
%install
%if !%{with test}
# Dont compile pydevd again
export SKIP_CYTHON_BUILD=1
%{python_expand # override install-lib: the vendored pydevd is not pure
%{$python_install} --install-lib %{$python_sitearch}
rm -r %{buildroot}%{$python_sitearch}/debugpy/_vendored/pydevd/pydevd_attach_to_process/{common,linux_and_mac,windows}/
rm %{buildroot}%{$python_sitearch}/debugpy/_vendored/pydevd/_*/*.{c,h,pxd,pyx}
%fdupes %{buildroot}%{$python_sitearch}
}
%endif
%if %{with test}
%check
# extra flags are not added
donttest="test_custom_python_args"
# breakpoints and killing fail
donttest+=" or (test_flask and (breakpoint or exception))"
%pytest_arch -x -rfEs -k "not ($donttest)"
%endif
%if ! %{with test}
%files %{python_files}
%{python_sitearch}/%{modname}
%{python_sitearch}/%{modname}-%{version}*-info
%endif
%changelog