Bug#1040316: python3-minimal fails to install

2023-07-06 Thread Luna Jernberg
This is now fixed :)

Den tis 4 juli 2023 kl 21:27 skrev Eli Schwartz :
>
> This bug seems to have been caused by
> https://salsa.debian.org/cpython-team/python3-defaults/-/commit/8e243207fee371a7335674fc77db63044b62cb29
>
> It migrated from imp to importlib, but importlib doesn't imply
> importlib.util -- you cannot and AFAIK never have been able to import
> the top-level package and assume the nested modules are available.
>
> That being said, it did work for me in my (non-Debian :P) 3.11
> environment, purely because I had a .pth file that caused importlib.util
> to be imported at startup. (It is the stock setuptools one for namespace
> packages. You can isolate the interpreter a bit with -IS to catch this.)
>
> So a similar problem may explain why this wasn't caught during local
> testing. It probably makes sense to generally test this sort of thing
> with minimal packages installed, because sneaky .pth files will cause
> you issues all the time.
>



Bug#1040316: python3-minimal fails to install

2023-07-04 Thread Eli Schwartz
This bug seems to have been caused by
https://salsa.debian.org/cpython-team/python3-defaults/-/commit/8e243207fee371a7335674fc77db63044b62cb29

It migrated from imp to importlib, but importlib doesn't imply
importlib.util -- you cannot and AFAIK never have been able to import
the top-level package and assume the nested modules are available.

That being said, it did work for me in my (non-Debian :P) 3.11
environment, purely because I had a .pth file that caused importlib.util
to be imported at startup. (It is the stock setuptools one for namespace
packages. You can isolate the interpreter a bit with -IS to catch this.)

So a similar problem may explain why this wasn't caught during local
testing. It probably makes sense to generally test this sort of thing
with minimal packages installed, because sneaky .pth files will cause
you issues all the time.



Bug#1040316: python3-minimal fails to install

2023-07-04 Thread Chris

Confirmed. Patch seems to work.

On 7/4/23 13:10, Andreas Metzler wrote:

On 2023-07-04 Blair Noctis  wrote:

On Tue, 04 Jul 2023 14:37:49 +0300 Adrian Bunk  wrote:

[...]

 result = self._execute('import importlib; 
print(importlib.util.MAGIC_NUMBER)', version)
  
^^
   File "/usr/share/python3/debpython/interpreter.py", line 359, in _execute
 raise Exception('{} failed with status code {}'.format(command, 
output['returncode']))
Exception: ('python3.11', '-c', 'import importlib; 
print(importlib.util.MAGIC_NUMBER)') failed with status code 1

[...]

`import importlib` doesn't bring in `importlib.util`, need `import 
importlib.util`.
IDK if that's the cause though.

Hello,

patching as suggested ...

--- /tmp/interpreter.py 2023-07-04 19:06:11.131647132 +0200
+++ /chroots/sid/usr/share/python3/debpython/interpreter.py 2023-07-04 
19:06:48.915235377 +0200
@@ -230,7 +230,7 @@ class Interpreter:
  version = Version(version or self.version)
  if self.impl == 'cpython' and version << Version('3'):
  return ''
-result = self._execute('import importlib; 
print(importlib.util.MAGIC_NUMBER)', version)
+result = self._execute('import importlib.util; 
print(importlib.util.MAGIC_NUMBER)', version)
  return eval(result)

  def magic_tag(self, version=None):

... seems to work.

cu Andreas




--
Keep well,
Chris
<><



Bug#1040316: python3-minimal fails to install

2023-07-04 Thread LaDerrick H
I experienced the same bug but worked around it by replacing
/usr/share/python3/debpython/interpreter.py with a version from a system
with "python3-minimal/unstable,now 3.11.4-1 amd64" installed.

Here's the diff:
diff -Naur /usr/share/python3/debpython/interpreter.py interpreter.py
--- /usr/share/python3/debpython/interpreter.py 2023-07-04 05:08:14.0 
-0500
+++ interpreter.py  2023-07-04 11:56:57.957669696 -0500
@@ -230,7 +230,7 @@
 version = Version(version or self.version)
 if self.impl == 'cpython' and version << Version('3'):
 return ''
-result = self._execute('import importlib; 
print(importlib.util.MAGIC_NUMBER)', version)
+result = self._execute('import imp; print(imp.get_magic())', version)
 return eval(result)
 
 def magic_tag(self, version=None):
@@ -243,7 +243,7 @@
 version = Version(version or self.version)
 if self.impl == 'cpython' and version << Version('3.2'):
 return ''
-return self._execute('import sys; 
print(sys.implementation.cache_tag)', version)
+return self._execute('import imp; print(imp.get_tag())', version)
 
 def multiarch(self, version=None):
 """Return multiarch tag."""



Bug#1040316: python3-minimal fails to install

2023-07-04 Thread Andreas Metzler
On 2023-07-04 Blair Noctis  wrote:
> On Tue, 04 Jul 2023 14:37:49 +0300 Adrian Bunk  wrote:
[...]
> > result = self._execute('import importlib; 
> > print(importlib.util.MAGIC_NUMBER)', version)
> >  
> > ^^
> >   File "/usr/share/python3/debpython/interpreter.py", line 359, in _execute
> > raise Exception('{} failed with status code {}'.format(command, 
> > output['returncode']))
> > Exception: ('python3.11', '-c', 'import importlib; 
> > print(importlib.util.MAGIC_NUMBER)') failed with status code 1
[...]
> `import importlib` doesn't bring in `importlib.util`, need `import 
> importlib.util`.

> IDK if that's the cause though.

Hello,

patching as suggested ...

--- /tmp/interpreter.py 2023-07-04 19:06:11.131647132 +0200
+++ /chroots/sid/usr/share/python3/debpython/interpreter.py 2023-07-04 
19:06:48.915235377 +0200
@@ -230,7 +230,7 @@ class Interpreter:
 version = Version(version or self.version)
 if self.impl == 'cpython' and version << Version('3'):
 return ''
-result = self._execute('import importlib; 
print(importlib.util.MAGIC_NUMBER)', version)
+result = self._execute('import importlib.util; 
print(importlib.util.MAGIC_NUMBER)', version)
 return eval(result)

 def magic_tag(self, version=None):

... seems to work.

cu Andreas


-- 
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'



Bug#1040316: python3-minimal fails to install

2023-07-04 Thread Luna Jernberg
Having this problem too :( on Debian unstable on ARM64

Den tis 4 juli 2023 kl 17:18 skrev Andreas Tille :
>
> Hi,
>
> I can confirm this problem here in a clean unstable chroot.
>
> Kind regards
> Andreas.
>
> --
> http://fam-tille.de
>



Bug#1040316: python3-minimal fails to install

2023-07-04 Thread Blair Noctis
On Tue, 04 Jul 2023 14:37:49 +0300 Adrian Bunk  wrote:
> Package: python3-minimal
> Version: 3.11.4-3
> Severity: grave
> 
> https://buildd.debian.org/status/fetch.php?pkg=phoc=amd64=0.29.0%2Bds-1=1688470391=0
> 
> ...
> Setting up python3-minimal (3.11.4-3) ...
> Traceback (most recent call last):
>   File "/usr/bin/py3compile", line 323, in 
> main()
>   File "/usr/bin/py3compile", line 294, in main
> compile(files, compile_versions, options.force,
>   File "/usr/bin/py3compile", line 203, in compile
> interpreter.magic_number(version),
> ^
>   File "/usr/share/python3/debpython/interpreter.py", line 233, in 
> magic_number
> result = self._execute('import importlib; 
> print(importlib.util.MAGIC_NUMBER)', version)
>  
> ^^
>   File "/usr/share/python3/debpython/interpreter.py", line 359, in _execute
> raise Exception('{} failed with status code {}'.format(command, 
> output['returncode']))
> Exception: ('python3.11', '-c', 'import importlib; 
> print(importlib.util.MAGIC_NUMBER)') failed with status code 1
> dpkg: error processing package python3-minimal (--configure):
>  installed python3-minimal package post-installation script subprocess 
> returned error exit status 1
> ...
> 
> 

`import importlib` doesn't bring in `importlib.util`, need `import 
importlib.util`.

IDK if that's the cause though.

-- 
Sdrager,
Blair Noctis


OpenPGP_signature
Description: OpenPGP digital signature


Bug#1040316: python3-minimal fails to install

2023-07-04 Thread Chris

Package: python3-minimal
Version: 3.11.4-3
Followup-For: Bug #1040316

Setting up python3-minimal (3.11.4-3) ...
Traceback (most recent call last):
  File "/usr/bin/py3compile", line 323, in 
    main()
  File "/usr/bin/py3compile", line 294, in main
    compile(files, compile_versions, options.force,
  File "/usr/bin/py3compile", line 203, in compile
    interpreter.magic_number(version),
    ^
  File "/usr/share/python3/debpython/interpreter.py", line 233, in 
magic_number
    result = self._execute('import importlib; 
print(importlib.util.MAGIC_NUMBER)', version)

^^
  File "/usr/share/python3/debpython/interpreter.py", line 359, in _execute
    raise Exception('{} failed with status code {}'.format(command, 
output['returncode']))
Exception: ('python3.11', '-c', 'import importlib; 
print(importlib.util.MAGIC_NUMBER)') failed with status code 1

dpkg: error processing package python3-minimal (--configure):
 installed python3-minimal package post-installation script subprocess 
returned error exit status 1

Errors were encountered while processing:
 python3-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.3.0-1-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE 
not set

Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-minimal depends on:
ii  dpkg    1.21.22
ii  python3.11-minimal  3.11.4-1

python3-minimal recommends no packages.

python3-minimal suggests no packages.

-- no debconf information

--
Keep well,
Chris
<><



Bug#1040316: python3-minimal fails to install

2023-07-04 Thread Andreas Tille
Hi,

I can confirm this problem here in a clean unstable chroot.

Kind regards
Andreas.

-- 
http://fam-tille.de



Bug#1040316: python3-minimal fails to install

2023-07-04 Thread Adrian Bunk
Package: python3-minimal
Version: 3.11.4-3
Severity: grave

https://buildd.debian.org/status/fetch.php?pkg=phoc=amd64=0.29.0%2Bds-1=1688470391=0

...
Setting up python3-minimal (3.11.4-3) ...
Traceback (most recent call last):
  File "/usr/bin/py3compile", line 323, in 
main()
  File "/usr/bin/py3compile", line 294, in main
compile(files, compile_versions, options.force,
  File "/usr/bin/py3compile", line 203, in compile
interpreter.magic_number(version),
^
  File "/usr/share/python3/debpython/interpreter.py", line 233, in magic_number
result = self._execute('import importlib; 
print(importlib.util.MAGIC_NUMBER)', version)
 
^^
  File "/usr/share/python3/debpython/interpreter.py", line 359, in _execute
raise Exception('{} failed with status code {}'.format(command, 
output['returncode']))
Exception: ('python3.11', '-c', 'import importlib; 
print(importlib.util.MAGIC_NUMBER)') failed with status code 1
dpkg: error processing package python3-minimal (--configure):
 installed python3-minimal package post-installation script subprocess returned 
error exit status 1
...