On Thu, 19 Jan 2017 14:13:24 +0000 James Clarke <[email protected]> wrote:
> On 19 Jan 2017, at 13:29, Jerome Kieffer <[email protected]> wrote: > > > > On Thu, 19 Jan 2017 11:50:18 +0000 > > Ghislain Vaillant <[email protected]> wrote: > > > > > >>>> Then there's the additional complication that x32 is a 32-bit version of > >>>> amd64, so it shouldn't fail the test. Therefore, I would propose > >>>> something like the following Debian-specific hack: > >>>> > >>>> host_cpu = subprocess.check_output(['dpkg-architecture', > >>>> '-qDEB_HOST_ARCH_CPU']) > >>>> if host_cpu != 'i386': > >>>> # Do the assert > > > > Have you tried platfrom.machine ? it return either "i386" or "i686" > > > > It is cleaner but I don't know how it behaves with an "x32" kernel. > > That doesn't help with i386 (or x32) chroots on an amd64 kernel. > > root@debian:/# uname -a > Linux debian 4.9.0-1-amd64 #1 SMP Debian 4.9.2-2 (2017-01-12) x86_64 GNU/Linux > root@debian:/# dpkg-architecture -qDEB_HOST_ARCH_CPU > i386 > root@debian:/# python3 -c "import platform; print(platform.machine())" > x86_64 If one wants to know if you are running a python in 32 or 64 bits: python -c "print(tuple.__itemsize__*8)" This is independent on the operating system. Cheers, -- Jérôme Kieffer

