Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8359585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:11:23+00:00 2026-06-09T11:11:23+00:00

I am trying to get ctags to be automatically run when I do a

  • 0

I am trying to get ctags to be automatically run when I do a scons. I have a custom builder based on this answer that allows me to run ctags from within my SConscript file. This works in as far as I get a tags file in the appropriate directory. However, since the builder runs within the root directory and not the subdirectory, I get the wrong paths (aka from the root, not the subdirectory) for all the files contains within the tags file. Apart from using sed to strip paths in the tags file, anyone can offer a suggestion as to how to make scons generate the right paths?

In effects, I would like to run the builder in a specific directory (aka the one where the SConscript is located, maybe passed as an option?) and not from the project root.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:11:25+00:00Added an answer on June 9, 2026 at 11:11 am

    This is the builder code I ended up using. Notice that the ctags command has a --tag-relative=yes option to it.

    # -*- coding: utf-8 -*-
    import SCons.Builder
    import SCons.Action
    
    def complain_ctags(target, source, env):
        print 'INFORMATION: ctags binary was not found (see above). Tags have not been built.'
    
    def generate(env):
        env['CTAGS'] = find_ctags(env)
        if env['CTAGS'] != None:
            #env['CTAGSCOM'] = 'cd $TARGET.dir; ctags -R .'
            env['CTAGSCOM'] = '$CTAGS --tag-relative=yes -f $TARGET $SOURCES'
            env['BUILDERS']['ctags'] = SCons.Builder.Builder(action=env['CTAGSCOM'])
        else:
            env['BUILDERS']['ctags'] = SCons.Builder.Builder(action=env.Action(complain_ctags))
    
    def find_ctags(env):
        b=env.WhereIs('ctags')
        if b == None:
            print 'Searching for ctags: not found. Tags will not be built'
        else:
            print 'Searching for ctags: ', b
        return b
    
    def exists(env):
        if find_ctags(env) == None:
            return 0
        return 1
    

    In my Sconscript file(s), I can now do:

    Alias('tags', env.ctags(source=all_python_files, target='tags'))
    

    The tags file now contains tags with path relative to the location of the tags file and not from the scons root directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying get my first simple project in rails to run. I have
I am trying get a div that I have hidden to show in the
I'm trying get the visible portion of UIImage from an UIImageView . UIImageView takes
Trying to get this expression to work, can someone look at it and tell
After downloading and installing exuberant ctags, I get some issues hinting that the ctags
I am trying get content from the link https://....com:8455 where Server's certificate is not
I am trying get the html within .event_recur. $(.entry).each(function(){ alert($(this).find(.event_recur).html()); }); <div class=entry> <p
When I'm trying get method from remote webservice it gives me error. My code
I'm trying get cross compiling between 2.7.7 and 2.8.0. The package is included, this
I'm trying get bytes from bitmap in blackberry using the next method in Bitmap:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.