@@ -500,47 +500,60 @@ In addition, command expansions (unlike other variable expansions) may
500
500
include nested variable expansions. So something like this is allowed:
501
501
502
502
```
503
- 'variables' : [
503
+ 'variables' : {
504
504
'foo': '<!(echo Build Date <!(date))',
505
- ] ,
505
+ } ,
506
506
```
507
507
508
508
expands to:
509
509
510
510
```
511
- 'variables' : [
511
+ 'variables' : {
512
512
'foo': 'Build Date 02:10:38 PM Fri Jul 24, 2009 -0700 PDT',
513
- ] ,
513
+ } ,
514
514
```
515
515
516
516
You may also put commands into arrays in order to quote arguments (but
517
517
note that you need to use a different string quoting character):
518
518
519
519
```
520
- 'variables' : [
520
+ 'variables' : {
521
521
'files': '<!([ "ls", "-1", "Filename With Spaces"] )',
522
- ] ,
522
+ } ,
523
523
```
524
524
525
525
GYP treats command failures (as indicated by a nonzero exit status)
526
526
during command expansion as errors.
527
527
528
- #### Example
528
+ #### pymod_do_main
529
529
530
+ You can use the special `pymod_do_main` symbol to get GYP to import the specified Python module, and call it's `DoMain`
531
+ method passing any parameters given.
532
+
533
+ ```python
534
+ {
535
+ 'variables' : {
536
+ 'res': '<!pymod_do_main(modulename par ame ters)',
537
+ },
538
+ }
530
539
```
540
+
541
+ #### Example
542
+
543
+ ``` python
531
544
{
532
545
' sources' : [
533
- '!(echo filename with space.cc)',
546
+ ' < !(echo filename with space.cc)' ,
534
547
],
535
548
' libraries' : [
536
- '!@(pkg-config --libs-only-l apr-1)',
549
+ ' < !@(pkg-config --libs-only-l apr-1)' ,
537
550
],
538
551
}
539
552
```
540
553
541
554
might expand to:
542
555
543
- ```
556
+ ``` python
544
557
{
545
558
' sources' : [
546
559
' filename with space.cc' , # no @, expands into a single string
@@ -558,18 +571,13 @@ Conditionals use the same set of variables used for variable expansion.
558
571
As with variable expansion, there are two phases of conditional
559
572
evaluation:
560
573
561
- * “Early” or “pre” conditional evaluation, introduced in
562
- [conditions](#conditions) sections.
563
- * “Late,” “post,” or “target” conditional evaluation, introduced in
564
- [target\_conditions](#target_conditions) sections.
574
+ * “Early” or “pre” conditional evaluation, introduced in [ conditions] ( #conditions ) sections.
575
+ * “Late”, “post”, or “target” conditional evaluation, introduced in [ target\_ conditions] ( #target_conditions ) sections.
565
576
566
- The syntax for each type is identical, they differ only in the key name
567
- used to identify them and the timing of their evaluation. A more
568
- complete description of syntax and use is provided in
569
- [conditions](#conditions).
577
+ The syntax for each type is identical, they differ only in the key name used to identify them and the timing of their evaluation.
578
+ A more complete description of syntax and use is provided in [ conditions] ( #conditions ) .
570
579
571
- The difference the two phases of evaluation is described in [Early and
572
- Late Phases](#Early_and_Late_Phases).
580
+ The difference the two phases of evaluation is described in [ Early and Late Phases] ( #Early_and_Late_Phases ) .
573
581
574
582
## Timing of Variable Expansion and Conditional Evaluation
575
583
@@ -578,13 +586,11 @@ Late Phases](#Early_and_Late_Phases).
578
586
GYP performs two phases of variable expansion and conditional evaluation:
579
587
580
588
* The “early” or “pre” phase operates on [ conditions] ( #conditions )
581
- sections and the `<` form of [variable
582
- expansions](#Variable_Expansions).
589
+ sections and the ` < ` form of [ variable expansions] ( #Variable_Expansions ) .
583
590
* The “late,” “post,” or “target” phase operates on
584
591
[ target\_ conditions] ( #target_conditions ) sections, the ` > ` form
585
592
of [ variable expansions] ( #Variable_Expansions ) ,
586
- and on the `!` form of [command
587
- expansions](#Command_Expansions_(!,_!@)).
593
+ and on the ` ! ` form of [ command expansions] ( #Command_Expansions_(!,_!@) ) .
588
594
589
595
These two phases are provided because there are some circumstances in
590
596
which each is desirable.
@@ -604,7 +610,7 @@ behaviors depending on the specifics of a target.
604
610
605
611
Given this input:
606
612
607
- ```
613
+ ``` python
608
614
{
609
615
' target_defaults' : {
610
616
' target_conditions' : [
0 commit comments