This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: distutils/util.py get_platform() does not identify linux-i686 platforms
Type: Stage: resolved
Components: Distutils Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: dstufft, eric.araujo, jaraco, siming85, steve.dower
Priority: normal Keywords:

Created on 2017-08-15 16:20 by siming85, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (5)
msg300300 - (view) Author: Siming Yuan (siming85) * Date: 2017-08-15 16:20
in CentOS installations where both 32 and 64 bit libraries can co exist, and when python is compiled to run with 32-bit libraries (i686)

>>> from distutils.util import get_platform
>>> get_platform()
'linux-x86_64'

because the api only looks at OS flavor and not the actual binary architecture.

this string is used as part of PEP425 tags in the built wheel/egg file:
my_package-3.3.0-cp34-cp34m-linux-x86_64.whl

but this creates a mismatch with PIP - pip.pep425tags returns "linux-i686" instead on the same python instance, addressed by:

# snippet pip code
def _is_running_32bit():
    return sys.maxsize == 2147483647
    
if result == "linux_x86_64" and _is_running_32bit():
    # 32 bit Python program (running on a 64 bit Linux): pip should only
    # install and run 32 bit compiled extensions in that case.
    result = "linux_i686"

so the end result is any packages built with sdist_wheel (using setuptools/distutils) is not installable on the same instance.

Of course the workaround is to overwrite that and provide --plat-name linux_i686. 

but the question is - shouldn't the tags line up?
msg300318 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2017-08-15 23:23
Hello!  Your analysis sounds right, but this is the wrong place.  distutils doesn’t know about wheels, it’s setuptools and/or the wheel module that generate them, and pip and others who consumes them.  Please report the issue to the setuptools and/or wheel bug trackers (see https://packaging.python.org/key_projects/ ) and I’ll close this one.
msg300387 - (view) Author: Siming Yuan (siming85) * Date: 2017-08-16 20:38
Hi Eric

I understand where you are coming from, but I disagree with having to raise this to 3rd party tools.

both wheel/pip makes calls to distutils.util.get_platform(). Fixing it in one location would fix it across the board.

In addition, taking setuptools & pip out of picture (uninstalling), using just distutils.core.setup() and doing a bdist (built-in command available in distutils) is still generating a wrong tag in linux 32-bit arch.

pkg-1.0.0.linux-x86_64.tar.gz

within distutils.util.get_platform() the code under sunos makes attempts to identify the correct bitness:
            bitness = {2147483647:"32bit", 9223372036854775807:"64bit"}
            machine += ".%s" % bitness[sys.maxsize]

why would the linux logic not handle the same problem?
msg300515 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2017-08-18 16:37
> both wheel/pip makes calls to distutils.util.get_platform(). Fixing it in one location
> would fix it across the board.

True, but it may have unintended effects in other places that disrupt or break parts of the CPython build process, or downstream packaging toolchains.

> using just distutils.core.setup() and doing a bdist (built-in command available in
> distutils) is still generating a wrong tag in linux 32-bit arch.

I would say that this is irrelevant, since these kinds of bdist are not well defined and not really used.

> within distutils.util.get_platform() the code under sunos makes attempts to identify the > correct bitness: [...]
> why would the linux logic not handle the same problem?

That’s always the question with distutils, and the reason for us being over-cautious with these requests for changes.  One needs to do VCS archaeology to understand if a specific line was a conscious decision, an assumption, an oversight or a mistake.  My suggestion of bringing this to setuptools is because they have a much faster release cycle, and broad testing.  They can change only the wheel compatibility tags and get feedback immediately, whereas changing distutils.util.get_plaform may break many things and we’ll only know in a couple years when the next release is packaged by distributions and third-party vendors.

[removing Raymond from nosy and adding Jason the setuptools maintainer]
msg386322 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021-02-03 18:19
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools
History
Date User Action Args
2022-04-11 14:58:50adminsetgithub: 75394
2021-02-03 18:19:05steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386322

resolution: out of date
stage: resolved
2017-08-18 16:37:21eric.araujosetnosy: + jaraco, - rhettinger
messages: + msg300515
2017-08-16 20:39:31siming85setnosy: + rhettinger
2017-08-16 20:38:06siming85setstatus: pending -> open
resolution: third party -> (no value)
messages: + msg300387
2017-08-15 23:23:33eric.araujosetstatus: open -> pending
resolution: third party
messages: + msg300318

versions: - Python 3.4, Python 3.5
2017-08-15 16:20:30siming85create