@@ -385,8 +385,10 @@ def derive_setup_local(
385
385
386
386
# Translate our YAML metadata into Setup lines.
387
387
388
- # All extensions are statically linked.
389
- dest_lines = [b"*static*" ]
388
+ section_lines = {
389
+ "disabled" : [],
390
+ "static" : [],
391
+ }
390
392
391
393
# makesetup parses lines with = as extra config options. There appears
392
394
# to be no easy way to define e.g. -Dfoo=bar in Setup.local. We hack
@@ -397,7 +399,11 @@ def derive_setup_local(
397
399
enabled_extensions = {}
398
400
399
401
for name , info in sorted (extension_modules .items ()):
400
- if name in disabled or name in ignored :
402
+ if name in ignored :
403
+ continue
404
+
405
+ if name in disabled :
406
+ section_lines ["disabled" ].append (name .encode ("ascii" ))
401
407
continue
402
408
403
409
enabled_extensions [name ] = dict (info )
@@ -421,6 +427,8 @@ def derive_setup_local(
421
427
enabled_extensions [name ]["setup_line" ] = name .encode ("ascii" )
422
428
continue
423
429
430
+ section = "static"
431
+
424
432
# Presumably this means the extension comes from the distribution's
425
433
# Setup. Lack of sources means we don't need to derive a Setup.local
426
434
# line.
@@ -535,11 +543,14 @@ def derive_setup_local(
535
543
"makesetup: %s" % line .decode ("utf-8" )
536
544
)
537
545
538
- dest_lines .append (line )
546
+ section_lines [ section ] .append (line )
539
547
enabled_extensions [name ]["setup_line" ] = line
540
548
541
- dest_lines .append (b"\n *disabled*\n " )
542
- dest_lines .extend (sorted (x .encode ("ascii" ) for x in disabled ))
549
+ dest_lines = []
550
+
551
+ for section , lines in sorted (section_lines .items ()):
552
+ dest_lines .append (b"\n *%s*\n " % section .encode ("ascii" ))
553
+ dest_lines .extend (lines )
543
554
544
555
dest_lines .append (b"" )
545
556
0 commit comments