Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add SCons files to ack searches

Tags:

scons

ack

I love the code search utility ack. It is smart enough to look through Makefiles, but doesn't know about the SConstruct and SConscript files that scons uses. How do I add those to the files that ack will look in?

like image 621
jblocksom Avatar asked Dec 28 '10 17:12

jblocksom


People also ask

What does SCons command do?

scons can scan known input files automatically for dependency information (for example, #include statements in C or C++ files) and will rebuild dependent files appropriately whenever any "included" input file changes. scons supports the ability to define new scanners for unknown input file types.

Where is SCons installed?

If your Linux distribution does not already have a specific SCons RPM file, you can download and install from the generic RPM provided by the SCons project. This will install the SCons script(s) in /usr/bin, and the SCons library modules in /usr/lib/scons.

How do you clean SCons?

When using SCons, it is unnecessary to add special commands or target names to clean up after a build. Instead, you simply use the -c or --clean option when you invoke SCons, and SCons removes the appropriate built files.

What compiler does SCons use?

The Visual C++ compiler option that SCons uses by default to generate PDB information is /Z7 . This works correctly with parallel ( -j ) builds because it embeds the debug information in the intermediate object files, as opposed to sharing a single PDB file between multiple object files.


1 Answers

Here is a patch that treats SCons files like make files:

--- ~/bin/ack-old 2011-06-01 15:43:51.000000000 -0600
+++ ~/bin/ack     2011-06-01 15:42:09.000000000 -0600
@@ -1583,6 +1583,8 @@

     return 'skipped' unless is_searchable( $basename );

+    return ('python',TEXT)      if $basename eq 'SConstruct' || $basename eq 'SConscript';
+
     my $lc_basename = lc $basename;
     return ('make',TEXT)        if $lc_basename eq 'makefile' || $lc_basename eq 'gnumakefile';
     return ('rake','ruby',TEXT) if $lc_basename eq 'rakefile';
like image 152
John Wasinger Avatar answered Sep 20 '22 08:09

John Wasinger