@@ -729,43 +729,53 @@ searching the repositories.
729
729
730
730
<scons_function name =" DefaultEnvironment" >
731
731
<arguments signature =" global" >
732
- ([**kwargs ])
732
+ ([key=value, ... ])
733
733
</arguments >
734
734
<summary >
735
735
<para >
736
736
Instantiates and returns the global &consenv; object.
737
- This environment is used internally by SCons
738
- when it executes many of the global functions listed in this section
739
- (that is, those not called as methods of a specific &consenv; ).
740
- The &defenv; is a singleton:
741
- the keyword arguments are used only on the first call;
742
- on subsequent calls the already-constructed object is returned
737
+ The <firstterm >&DefEnv; </firstterm > is used internally by &SCons;
738
+ when executing a global function
739
+ or the global form of a Builder method
740
+ that requires access to a &consenv; .
741
+ </para >
742
+
743
+ <para >
744
+ On the first call,
745
+ arguments are interpreted as for the &f-link-Environment; function.
746
+ The &DefEnv; is a singleton;
747
+ subsequent calls to &f-DefaultEnvironment; return
748
+ the already-constructed object,
743
749
and any keyword arguments are silently ignored.
744
- The &defenv; can still be modified after instantiation
745
- in the same way as any other &consenv; .
746
- The &defenv; is independent:
747
- modifying it has no effect on any other &consenv;
748
- constructed by an &f-link-Environment; or &f-link-Clone; call.
749
- </para >
750
-
751
- <para >
752
- It is not mandatory to call &f-DefaultEnvironment; :
753
- the &defenv; is instantiated automatically when the
754
- build phase begins if this function has not been called;
755
- however calling it explicitly gives the opportunity to
756
- affect and examine the contents of the &defenv; .
757
- Instantiation happens even if no build instructions
758
- appar to use it, as there are internal uses.
759
- If there are no uses in the project &SConscript; files,
760
- a small performance gain may be seen by calling
761
- &f-DefaultEnvironment; with an empty tools list,
762
- thus avoiding that part of the initialization cost.
763
- This is mainly of interest in testing when &scons; is
764
- launched repeatedly in a short time period:
765
750
</para >
766
- <example_commands >
767
- DefaultEnvironment(tools=[])
768
- </example_commands >
751
+
752
+ <para >
753
+ The &DefEnv; can be modified after instantiation,
754
+ similar to other &consenvs; ,
755
+ although some &consenv; methods may be unavailable.
756
+ Modifying the &DefEnv; has no effect on any other &consenv; ,
757
+ either existing or newly constructed.
758
+ </para >
759
+
760
+ <para >
761
+ It is not necessary to explicitly call &f-DefaultEnvironment; .
762
+ &SCons; instantiates the &defenv; automatically when the
763
+ build phase begins, if has not already been done.
764
+ However, calling it explicitly provides the opportunity to
765
+ affect and examine its contents.
766
+ Instantiation occurs even if nothing in the build system
767
+ appars to use it, due to internal uses.
768
+ </para >
769
+
770
+ <para >
771
+ If the project &SConscript; files do not use global functions or Builders,
772
+ a small performance gain may be achieved by calling
773
+ &f-DefaultEnvironment; with an empty tools list
774
+ (<userinput >DefaultEnvironment(tools=[])</userinput >).
775
+ This avoids the tool initialization cost for the &DefEnv; ,
776
+ which is mainly of interest in the test suite
777
+ where &scons; is launched repeatedly in a short time period.
778
+ </para >
769
779
</summary >
770
780
</scons_function >
771
781
0 commit comments