Editing
Tutorial
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Creating an SConstruct=== Now that we have the three SConstruct commands, we can write our first SConstruct. To do so, open the SConstruct file in your favorite text editor. Before we can create any '''Flow''' , '''Plot''' or '''Result''' statements we have to add a first statement to the SConstruct. Enter the following statement (verbatim) into your new SConstruct: <pre> from rsf.proj import * </pre> This statement tells SCons where to find the '''Flow''' , '''Plot''' and '''Result''' commands, and must be included in '''every''' SConstruct. After that statement has been entered, you can enter as many '''Flow''' , '''Plot''' and '''Result''' commands as you wish making sure to use proper syntax. It's helpful to use a text editor that has Python syntax highlighting, as that will help you find and remedy strings that are not closed. You can also create Python comments using the <math>\#</math> mark to indicate the beginning of a comment to help document your SConstructs. Lastly, you must include the following statement at the end of your SConstruct: <syntaxhighlight lang="python"> End() </syntaxhighlight> This statement tells SCons that the script is done and that it should not look for anything else in the script. Make sure to include this statement as the very last item in every SConstruct. Here's a sample SConstruct: <syntaxhighlight lang="python"> from rsf.proj import * # Remember, this statement comes first... ALWAYS Flow("spike",None,"sfspike n1=100 k1=50") # None is a trick, see Advanced SCons for more information Flow("spike1","spike","sfadd scale=4.0") Flow("noise","spike1","sfnoise") Plot("spike",'sfgraph title="spike" ' ) # Note string nesting Plot("spike1",'sfgraph title="spike1" ') Plot("noise",'sfgraph title="noisy" ') Result("noise",'sfgraph title="noisy" pclip=75 ') End() # Remember, this always ends the script. </syntaxhighlight> Note: you do not have to order your '''Flow''' , '''Plot''' and '''Result''' commands as shown above. You can mix '''Flow''' , '''Plot''' and '''Result''' in any order. SCons automatically establishes the relationships between related files and commands.
Summary:
Please note that all contributions to Madagascar are considered to be released under the GNU Free Documentation License 1.3 or later (see
My wiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Getting Madagascar
download
Installation
GitHub repository
SEGTeX
Introduction
Package overview
Tutorial
Hands-on tour
Reproducible documents
Hall of Fame
User Documentation
List of programs
Common programs
Popular programs
The RSF file format
Reproducibility with SCons
Developer documentation
Adding programs
Contributing programs
API demo: clipping data
API demo: explicit finite differences
Community
Conferences
User mailing list
Developer mailing list
GitHub organization
LinkedIn group
Development blog
Twitter
Slack
Tools
What links here
Related changes
Special pages
Page information