Bug 2202

Summary: add waf option to check build profile
Product: ns-3 Reporter: Tom Henderson <tomh>
Component: build systemAssignee: Gustavo J. A. M. Carneiro <gjcarneiro>
Status: RESOLVED FIXED    
Severity: enhancement CC: natale.patriciello, ns-bugs
Priority: P5    
Version: pre-release   
Hardware: PC   
OS: Linux   
Attachments: proposed patch

Description Tom Henderson 2015-10-29 13:38:45 UTC
Created attachment 2166 [details]
proposed patch

I would like to add a waf build option to check the currently configured build profile, so I don't have to recurse into build/c4ch3/_cache.py to find this.

When executing './waf --help', the following option is printed after the '-d BUILD_PROFILE' option:

  -d BUILD_PROFILE, --build-profile=BUILD_PROFILE
                        Specify the build profile.  Build profiles control the
                        default compilation flags used for C/C++ programs, if
                        CCFLAGS/CXXFLAGS are not set in the environment.
                        [Allowed Values: 'debug', 'release', 'optimized']
  --check-profile       print out current build profile

When running './waf --check-profile', the following will print out:

  Waf: Entering directory `/path/to/ns-3-allinone/ns-3-dev/build'
  Build profile: debug


patch attached.
Comment 1 Gustavo J. A. M. Carneiro 2015-11-11 07:15:21 UTC
+1
Comment 2 Tom Henderson 2016-01-06 12:12:44 UTC
pushed in 11805:391bf90839ed
Comment 3 natale.patriciello 2016-01-07 05:38:55 UTC
Hello, 

I have this error:

Waf: The wscript in '/home/nat/Work/ns-3-dev-git' is unreadable
Traceback (most recent call last):
  File "/home/nat/Work/ns-3-dev-git/.waf3-1.8.16-62b1bd1a26843637845309e604a98bca/waflib/Scripting.py", line 100, in waf_entry_point
    set_main_module(os.path.normpath(os.path.join(Context.run_dir,Context.WSCRIPT_FILE)))
  File "/home/nat/Work/ns-3-dev-git/.waf3-1.8.16-62b1bd1a26843637845309e604a98bca/waflib/Scripting.py", line 125, in set_main_module
    Context.g_module=Context.load_module(file_path)
  File "/home/nat/Work/ns-3-dev-git/.waf3-1.8.16-62b1bd1a26843637845309e604a98bca/waflib/Context.py", line 354, in load_module
    try:exec(compile(code,path,'exec'),module.__dict__)
  File "/home/nat/Work/ns-3-dev-git/wscript", line 53, in <module>
    import cflags # override the build profiles from waf
  File "/home/nat/Work/ns-3-dev-git/waf-tools/cflags.py", line 159
    opt.add_option('--check-profile',
                                    ^
TabError: inconsistent use of tabs and spaces in indentation
Comment 4 Tom Henderson 2016-01-07 10:38:02 UTC
>                                     ^
> TabError: inconsistent use of tabs and spaces in indentation


I was able to reproduce this on a Python 3 installation; I pushed a fix in the subsequent changeset.