2121import pytest
2222
2323from packaging import tags
24+ from packaging ._manylinux import _GLibCVersion
2425from packaging ._musllinux import _MuslVersion
2526
2627
@@ -385,33 +386,37 @@ def test_linux_platforms_manylinux_unsupported(self, monkeypatch):
385386
386387 def test_linux_platforms_manylinux1 (self , monkeypatch ):
387388 monkeypatch .setattr (
388- tags ._manylinux , "_is_compatible" , lambda name , * args : name == "manylinux1"
389+ tags ._manylinux ,
390+ "_is_compatible" ,
391+ lambda _ , glibc_version : glibc_version == _GLibCVersion (2 , 5 ),
389392 )
390393 monkeypatch .setattr (sysconfig , "get_platform" , lambda : "linux_x86_64" )
391394 monkeypatch .setattr (platform , "machine" , lambda : "x86_64" )
392395 monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.20" , raising = False )
393396 platforms = list (tags ._linux_platforms (is_32bit = False ))
394- arch = platform .machine ()
395- assert platforms == ["manylinux1_" + arch , "linux_" + arch ]
397+ assert platforms == [
398+ "manylinux_2_5_x86_64" ,
399+ "manylinux1_x86_64" ,
400+ "linux_x86_64" ,
401+ ]
396402
397403 def test_linux_platforms_manylinux2010 (self , monkeypatch ):
398404 monkeypatch .setattr (sysconfig , "get_platform" , lambda : "linux_x86_64" )
399405 monkeypatch .setattr (platform , "machine" , lambda : "x86_64" )
400406 monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.12" , raising = False )
401407 platforms = list (tags ._linux_platforms (is_32bit = False ))
402- arch = platform .machine ()
403408 expected = [
404- "manylinux_2_12_" + arch ,
405- "manylinux2010_" + arch ,
406- "manylinux_2_11_" + arch ,
407- "manylinux_2_10_" + arch ,
408- "manylinux_2_9_" + arch ,
409- "manylinux_2_8_" + arch ,
410- "manylinux_2_7_" + arch ,
411- "manylinux_2_6_" + arch ,
412- "manylinux_2_5_" + arch ,
413- "manylinux1_" + arch ,
414- "linux_" + arch ,
409+ "manylinux_2_12_x86_64" ,
410+ "manylinux2010_x86_64" ,
411+ "manylinux_2_11_x86_64" ,
412+ "manylinux_2_10_x86_64" ,
413+ "manylinux_2_9_x86_64" ,
414+ "manylinux_2_8_x86_64" ,
415+ "manylinux_2_7_x86_64" ,
416+ "manylinux_2_6_x86_64" ,
417+ "manylinux_2_5_x86_64" ,
418+ "manylinux1_x86_64" ,
419+ "linux_x86_64" ,
415420 ]
416421 assert platforms == expected
417422
@@ -453,7 +458,7 @@ def test_linux_platforms_manylinux2014_armhf_abi(
453458 monkeypatch .setattr (
454459 tags ._manylinux ,
455460 "_is_compatible" ,
456- lambda name , * args : name == "manylinux2014" ,
461+ lambda _ , glibc_version : glibc_version == _GLibCVersion ( 2 , 17 ) ,
457462 )
458463 monkeypatch .setattr (sysconfig , "get_platform" , lambda : f"linux_{ native_arch } " )
459464 monkeypatch .setattr (
@@ -467,9 +472,10 @@ def test_linux_platforms_manylinux2014_armhf_abi(
467472 )
468473 platforms = list (tags ._linux_platforms (is_32bit = True ))
469474 archs = {"armv8l" : ["armv8l" , "armv7l" ]}.get (cross_arch , [cross_arch ])
470- expected = [f"manylinux2014_{ arch } " for arch in archs ] + [
471- f"linux_{ arch } " for arch in archs
472- ]
475+ expected = []
476+ for arch in archs :
477+ expected .extend ([f"manylinux_2_17_{ arch } " , f"manylinux2014_{ arch } " ])
478+ expected .extend (f"linux_{ arch } " for arch in archs )
473479 assert platforms == expected
474480
475481 def test_linux_platforms_manylinux2014_i386_abi (self , monkeypatch ):
@@ -509,7 +515,7 @@ def test_linux_platforms_manylinux2014_i386_abi(self, monkeypatch):
509515 def test_linux_platforms_manylinux_glibc3 (self , monkeypatch ):
510516 # test for a future glic 3.x version
511517 monkeypatch .setattr (tags ._manylinux , "_glibc_version_string" , lambda : "3.2" )
512- monkeypatch .setattr (tags ._manylinux , "_is_compatible" , lambda name , * args : True )
518+ monkeypatch .setattr (tags ._manylinux , "_is_compatible" , lambda * args : True )
513519 monkeypatch .setattr (sysconfig , "get_platform" , lambda : "linux_aarch64" )
514520 monkeypatch .setattr (
515521 sys ,
@@ -569,7 +575,9 @@ def test_linux_platforms_musllinux(
569575
570576 def test_linux_platforms_manylinux2014_armv6l (self , monkeypatch ):
571577 monkeypatch .setattr (
572- tags ._manylinux , "_is_compatible" , lambda name , _ : name == "manylinux2014"
578+ tags ._manylinux ,
579+ "_is_compatible" ,
580+ lambda _ , glibc_version : glibc_version == _GLibCVersion (2 , 17 ),
573581 )
574582 monkeypatch .setattr (sysconfig , "get_platform" , lambda : "linux_armv6l" )
575583 monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.20" , raising = False )
@@ -584,7 +592,7 @@ def test_linux_platforms_manylinux2014_armv6l(self, monkeypatch):
584592 def test_linux_platforms_not_manylinux_abi (
585593 self , monkeypatch , machine , abi , alt_machine
586594 ):
587- monkeypatch .setattr (tags ._manylinux , "_is_compatible" , lambda name , _ : False )
595+ monkeypatch .setattr (tags ._manylinux , "_is_compatible" , lambda * args : False )
588596 monkeypatch .setattr (sysconfig , "get_platform" , lambda : f"linux_{ machine } " )
589597 monkeypatch .setattr (
590598 sys ,
0 commit comments