Travis thinks the architecture is 32-bit, but Python disagrees

Viewed 61

I'm using Travis to test Python code on various versions and architectures. I'm trying to throw a 32-bit Linux architecture into the mix. The .travis.yml below seems to succeed in the sense that I see "i386" written next to the chip graphic in the table entry for my arch: x86 job. But I also see the following output in the log, from my introspective Python code:

$ python -c 'import sys,struct,platform;print("{\n%s}"%"".join("    %25r %c %r,\n"%(c,58,eval(c)) for c in """struct.calcsize("P")*8 sys.maxsize platform.machine() platform.architecture()""".split()))'
{
     'struct.calcsize("P")*8' : 64,
                'sys.maxsize' : 9223372036854775807,
         'platform.machine()' : 'x86_64',
    'platform.architecture()' : ('64bit', 'ELF'),
}

For a 32-bit build of Python, struct.calcsize("P")*8 should return 32 and sys.maxsize should be 2147483647. The output I'm actually getting implies a 64-bit build. And since I don't believe 64-bit binaries can run on 32-bit machines, something counterintuitive seems to be going on. What am I overlooking?

# Welcome to .travis.yml

os: linux
arch: x64
language: python
install:
    - python -c 'import sys,struct,platform;print("{\n%s}"%"".join("    %25r %c %r,\n"%(c,58,eval(c)) for c in """struct.calcsize("P")*8 sys.maxsize platform.machine() platform.architecture()""".split()))'
    - python -m pip install --upgrade pip
    - python -m pip install pytest
    - python -m pip install .

script:
    - python -m pytest -v .
    

matrix:
    include:
        - python: 2.7
        
        # ...
        
        - python: 3.8
      
        - name: "Python 3.8 on 32-bit Linux"
          arch: x86
          python: 3.8
0 Answers
Related