@@ -326,7 +326,7 @@ def test_is_manylinux_compatible_glibc_support(
326
326
("2.4" , 2 , 4 , True ),
327
327
("2.4" , 2 , 5 , False ),
328
328
("2.4" , 2 , 3 , True ),
329
- ("3.4" , 2 , 4 , False ),
329
+ ("3.4" , 2 , 4 , True ),
330
330
],
331
331
)
332
332
def test_check_glibc_version (self , version_str , major , minor , expected ):
@@ -373,6 +373,13 @@ def test_glibc_version_string_confstr(self, monkeypatch):
373
373
monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.20" , raising = False )
374
374
assert tags ._glibc_version_string_confstr () == "2.20"
375
375
376
+ def test_glibc_version_string_fail (self , monkeypatch ):
377
+ monkeypatch .setattr (os , "confstr" , lambda x : None , raising = False )
378
+ monkeypatch .setitem (sys .modules , "ctypes" , None )
379
+ assert tags ._glibc_version_string () is None
380
+ assert tags ._have_compatible_glibc (2 , 5 ) is False
381
+ assert tags ._get_glibc_version () == (- 1 , - 1 )
382
+
376
383
@pytest .mark .parametrize (
377
384
"failure" ,
378
385
[pretend .raiser (ValueError ), pretend .raiser (OSError ), lambda x : "XXX" ],
@@ -433,12 +440,14 @@ def test_linux_platforms_32_64bit_on_64bit_os(
433
440
self , arch , is_32bit , expected , monkeypatch
434
441
):
435
442
monkeypatch .setattr (distutils .util , "get_platform" , lambda : arch )
443
+ monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.20" , raising = False )
436
444
monkeypatch .setattr (tags , "_is_manylinux_compatible" , lambda * args : False )
437
445
linux_platform = list (tags ._linux_platforms (is_32bit = is_32bit ))[- 1 ]
438
446
assert linux_platform == expected
439
447
440
448
def test_linux_platforms_manylinux_unsupported (self , monkeypatch ):
441
449
monkeypatch .setattr (distutils .util , "get_platform" , lambda : "linux_x86_64" )
450
+ monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.20" , raising = False )
442
451
monkeypatch .setattr (tags , "_is_manylinux_compatible" , lambda * args : False )
443
452
linux_platform = list (tags ._linux_platforms (is_32bit = False ))
444
453
assert linux_platform == ["linux_x86_64" ]
@@ -450,6 +459,7 @@ def test_linux_platforms_manylinux1(self, is_x86, monkeypatch):
450
459
if platform .system () != "Linux" or not is_x86 :
451
460
monkeypatch .setattr (distutils .util , "get_platform" , lambda : "linux_x86_64" )
452
461
monkeypatch .setattr (platform , "machine" , lambda : "x86_64" )
462
+ monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.20" , raising = False )
453
463
platforms = list (tags ._linux_platforms (is_32bit = False ))
454
464
arch = platform .machine ()
455
465
assert platforms == ["manylinux1_" + arch , "linux_" + arch ]
@@ -461,9 +471,21 @@ def test_linux_platforms_manylinux2010(self, is_x86, monkeypatch):
461
471
if platform .system () != "Linux" or not is_x86 :
462
472
monkeypatch .setattr (distutils .util , "get_platform" , lambda : "linux_x86_64" )
463
473
monkeypatch .setattr (platform , "machine" , lambda : "x86_64" )
474
+ monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.20" , raising = False )
464
475
platforms = list (tags ._linux_platforms (is_32bit = False ))
465
476
arch = platform .machine ()
466
- expected = ["manylinux2010_" + arch , "manylinux1_" + arch , "linux_" + arch ]
477
+ expected = [
478
+ "manylinux2010_" + arch ,
479
+ "manylinux_2_11_" + arch ,
480
+ "manylinux_2_10_" + arch ,
481
+ "manylinux_2_9_" + arch ,
482
+ "manylinux_2_8_" + arch ,
483
+ "manylinux_2_7_" + arch ,
484
+ "manylinux_2_6_" + arch ,
485
+ "manylinux_2_5_" + arch ,
486
+ "manylinux1_" + arch ,
487
+ "linux_" + arch ,
488
+ ]
467
489
assert platforms == expected
468
490
469
491
def test_linux_platforms_manylinux2014 (self , is_x86 , monkeypatch ):
@@ -473,17 +495,31 @@ def test_linux_platforms_manylinux2014(self, is_x86, monkeypatch):
473
495
if platform .system () != "Linux" or not is_x86 :
474
496
monkeypatch .setattr (distutils .util , "get_platform" , lambda : "linux_x86_64" )
475
497
monkeypatch .setattr (platform , "machine" , lambda : "x86_64" )
498
+ monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.20" , raising = False )
476
499
platforms = list (tags ._linux_platforms (is_32bit = False ))
477
500
arch = platform .machine ()
478
501
expected = [
479
502
"manylinux2014_" + arch ,
503
+ "manylinux_2_16_" + arch ,
504
+ "manylinux_2_15_" + arch ,
505
+ "manylinux_2_14_" + arch ,
506
+ "manylinux_2_13_" + arch ,
507
+ "manylinux_2_12_" + arch ,
480
508
"manylinux2010_" + arch ,
509
+ "manylinux_2_11_" + arch ,
510
+ "manylinux_2_10_" + arch ,
511
+ "manylinux_2_9_" + arch ,
512
+ "manylinux_2_8_" + arch ,
513
+ "manylinux_2_7_" + arch ,
514
+ "manylinux_2_6_" + arch ,
515
+ "manylinux_2_5_" + arch ,
481
516
"manylinux1_" + arch ,
482
517
"linux_" + arch ,
483
518
]
484
519
assert platforms == expected
485
520
486
521
def test_linux_platforms_manylinux2014_armhf_abi (self , monkeypatch ):
522
+ monkeypatch .setattr (tags , "_glibc_version_string" , lambda : "2.30" )
487
523
monkeypatch .setattr (
488
524
tags , "_is_manylinux_compatible" , lambda name , _ : name == "manylinux2014"
489
525
)
@@ -498,6 +534,7 @@ def test_linux_platforms_manylinux2014_armhf_abi(self, monkeypatch):
498
534
assert platforms == expected
499
535
500
536
def test_linux_platforms_manylinux2014_i386_abi (self , monkeypatch ):
537
+ monkeypatch .setattr (tags , "_glibc_version_string" , lambda : "2.20" )
501
538
monkeypatch .setattr (
502
539
tags , "_is_manylinux_compatible" , lambda name , _ : name == "manylinux2014"
503
540
)
@@ -509,18 +546,50 @@ def test_linux_platforms_manylinux2014_i386_abi(self, monkeypatch):
509
546
)
510
547
platforms = list (tags ._linux_platforms (is_32bit = True ))
511
548
expected = [
549
+ # "manylinux_2_17_i686", # rejected since it comes before manylinux2014
512
550
"manylinux2014_i686" ,
551
+ "manylinux_2_16_i686" ,
552
+ "manylinux_2_15_i686" ,
553
+ "manylinux_2_14_i686" ,
554
+ "manylinux_2_13_i686" ,
555
+ "manylinux_2_12_i686" ,
513
556
"manylinux2010_i686" ,
557
+ "manylinux_2_11_i686" ,
558
+ "manylinux_2_10_i686" ,
559
+ "manylinux_2_9_i686" ,
560
+ "manylinux_2_8_i686" ,
561
+ "manylinux_2_7_i686" ,
562
+ "manylinux_2_6_i686" ,
563
+ "manylinux_2_5_i686" ,
514
564
"manylinux1_i686" ,
515
565
"linux_i686" ,
516
566
]
517
567
assert platforms == expected
518
568
569
+ def test_linux_platforms_manylinux_glibc3 (self , monkeypatch ):
570
+ # test for a future glic 3.x version
571
+ monkeypatch .setattr (tags , "_glibc_version_string" , lambda : "3.2" )
572
+ monkeypatch .setattr (tags , "_is_manylinux_compatible" , lambda name , _ : True )
573
+ monkeypatch .setattr (distutils .util , "get_platform" , lambda : "linux_aarch64" )
574
+ monkeypatch .setattr (
575
+ sys ,
576
+ "executable" ,
577
+ os .path .join (os .path .dirname (__file__ ), "hello-world-aarch64" ),
578
+ )
579
+ platforms = list (tags ._linux_platforms ())
580
+ expected = (
581
+ ["manylinux_3_2_aarch64" , "manylinux_3_1_aarch64" , "manylinux_3_0_aarch64" ]
582
+ + ["manylinux_2_{}_aarch64" .format (i ) for i in range (50 , 16 , - 1 )]
583
+ + ["manylinux2014_aarch64" , "linux_aarch64" ]
584
+ )
585
+ assert platforms == expected
586
+
519
587
def test_linux_platforms_manylinux2014_armv6l (self , monkeypatch ):
520
588
monkeypatch .setattr (
521
589
tags , "_is_manylinux_compatible" , lambda name , _ : name == "manylinux2014"
522
590
)
523
591
monkeypatch .setattr (distutils .util , "get_platform" , lambda : "linux_armv6l" )
592
+ monkeypatch .setattr (os , "confstr" , lambda x : "glibc 2.20" , raising = False )
524
593
platforms = list (tags ._linux_platforms (is_32bit = True ))
525
594
expected = ["linux_armv6l" ]
526
595
assert platforms == expected
0 commit comments