Bug#1059671: python3-capstone: Python 3.12 has no module named 'distutils'

2024-02-20 Thread Timo Röhling
On Fri, 2 Feb 2024 08:49:11 +0200 Graham Inggs  
wrote:

I believe all that is required here is patching out the import of
distutils.sysconfig:

--- a/bindings/python/capstone/__init__.py
+++ b/bindings/python/capstone/__init__.py
@@ -263,7 +263,6 @@

 import ctypes, ctypes.util
 from os.path import split, join, dirname
-import distutils.sysconfig

 import inspect
 if not hasattr(sys.modules[__name__], '__file__'):

...and dropping the dependency on python3-distutils:

--- a/debian/control
+++ b/debian/control
@@ -66,7 +67,6 @@
 Section: python
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, libcapstone4,
- python3-distutils
 XB-Python3-Version: ${python:Versions}
 Description: lightweight multi-architecture disassembly framework -
Python bindings
  Capstone is a lightweight multi-platform, multi-architecture disassembly


I just NMU'd capstone (see the attached diff)

Cheers
Timo


--
⢀⣴⠾⠻⢶⣦⠀   ╭╮
⣾⠁⢠⠒⠀⣿⡁   │ Timo Röhling   │
⢿⡄⠘⠷⠚⠋⠀   │ 9B03 EBB9 8300 DF97 C2B1  23BF CC8C 6BDD 1403 F4CA │
⠈⠳⣄   ╰╯
diff --git a/debian/changelog b/debian/changelog
index 0133e16a..09e72715 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+capstone (4.0.2-5.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Remove vestigial distutils.sysconfig import (Closes: #1059671)
+
+ -- Timo Röhling   Tue, 20 Feb 2024 21:30:13 +0100
+
 capstone (4.0.2-5) unstable; urgency=medium
 
   * Team upload.
diff --git a/debian/control b/debian/control
index a7d23515..9f422dc8 100644
--- a/debian/control
+++ b/debian/control
@@ -66,7 +66,6 @@ Package: python3-capstone
 Section: python
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, libcapstone4,
- python3-distutils
 XB-Python3-Version: ${python:Versions}
 Description: lightweight multi-architecture disassembly framework - Python bindings
  Capstone is a lightweight multi-platform, multi-architecture disassembly
diff --git a/debian/patches/0001-Remove-magic-for-loading-shared-libraries.patch b/debian/patches/0001-Remove-magic-for-loading-shared-libraries.patch
index 69f041b8..1f0e426a 100644
--- a/debian/patches/0001-Remove-magic-for-loading-shared-libraries.patch
+++ b/debian/patches/0001-Remove-magic-for-loading-shared-libraries.patch
@@ -3,17 +3,18 @@ Date: Wed, 25 Jul 2018 15:14:07 +0200
 Subject: Remove magic for loading shared libraries
 
 ---
- bindings/python/capstone/__init__.py | 46 +---
- 1 file changed, 1 insertion(+), 45 deletions(-)
+ bindings/python/capstone/__init__.py | 47 +---
+ 1 file changed, 1 insertion(+), 46 deletions(-)
 
 diff --git a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__init__.py
-index 757dc7d..4917af9 100644
+index 757dc7d..0bdb782 100644
 --- a/bindings/python/capstone/__init__.py
 +++ b/bindings/python/capstone/__init__.py
-@@ -264,56 +264,12 @@ CS_OPT   = {v:k for k,v in locals().items() if k.startswith('CS_OPT_')}
+@@ -263,57 +263,12 @@ CS_OPT   = {v:k for k,v in locals().items() if k.startswith('CS_OPT_')}
+ 
  import ctypes, ctypes.util
  from os.path import split, join, dirname
- import distutils.sysconfig
+-import distutils.sysconfig
 -import pkg_resources
  
  import inspect


signature.asc
Description: PGP signature


Bug#1059671: python3-capstone: Python 3.12 has no module named 'distutils'

2024-02-01 Thread Graham Inggs
Control: tags -1 + patch

Hi Maintainer

It turns out the usage of distutils.sysconfig.get_python_lib() was
already patched out in a previous patch [1].

I believe all that is required here is patching out the import of
distutils.sysconfig:

--- a/bindings/python/capstone/__init__.py
+++ b/bindings/python/capstone/__init__.py
@@ -263,7 +263,6 @@

 import ctypes, ctypes.util
 from os.path import split, join, dirname
-import distutils.sysconfig

 import inspect
 if not hasattr(sys.modules[__name__], '__file__'):

...and dropping the dependency on python3-distutils:

--- a/debian/control
+++ b/debian/control
@@ -66,7 +67,6 @@
 Section: python
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, libcapstone4,
- python3-distutils
 XB-Python3-Version: ${python:Versions}
 Description: lightweight multi-architecture disassembly framework -
Python bindings
  Capstone is a lightweight multi-platform, multi-architecture disassembly

Regards
Graham


[1] 
https://salsa.debian.org/pkg-security-team/capstone/-/blob/debian/4.0.2-5/debian/patches/0001-Remove-magic-for-loading-shared-libraries.patch?ref_type=tags#L57