#25 Handling of Python import


It would be nice if Python import statements were handled similar to C #includes, where the file links to the included file. It appears that currently, certain imported modules will link to a keyword search and others will be unlinked.

Syntax for the import statement can be found here: http://docs.python.org/reference/simple_stmts.html#the-import-statement


  • AdrianIssott

    AdrianIssott - 2009-06-19

    David, please could you provide some examples of when the import statements aren't linking to the included file.

  • David

    David - 2009-06-30

    sample output file

  • David

    David - 2009-06-30

    Sorry for the delay in responding, I had a few other things come up before I could get back to this.

    I've attached an HTML file with some sample output (I removed some of the header info, but you should still get the idea). "time" is a standard Python module, so I wouldn't necessarily expect LXR to be able to link to it. "version", "management", and "device" are all in the same directory as the test file. One thing to note is that the include statement doesn't include the .py filename extension.

  • Andre-Littoz

    Andre-Littoz - 2011-03-17
    • assigned_to: nobody --> ajlittoz
    • status: open --> pending
  • Andre-Littoz

    Andre-Littoz - 2011-03-17

    I have added a generic processing. Read feature request "cope with language-specific syntax for include files" to see if that suits your needs. To test, either extract from CVS or wait for the 0.9.9 release, due very soon.

    Please give feed back.

  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

  • SourceForge Robot

    • status: pending --> closed
  • Andre-Littoz

    Andre-Littoz - 2011-03-31

    Reopened manually after automatic close.
    To be put on "todo" list for a coming release

  • Andre-Littoz

    Andre-Littoz - 2011-03-31
    • status: closed --> open
  • David

    David - 2011-04-02

    Testing the patch is also on my todo list. Hopefully I'll have a chance to test this next week.

  • David

    David - 2011-04-11

    Just gave 0.9.9 a try; got an error when I tried to update the index:

    Sequence (?|...) not recognized in regex; marked by <-- HERE in m/^ # reminder: no initial space in the grammar
    ([\w\#]\s*[\w]*) # reserved keyword for include construct
    (\s+) # space
    (?| <-- HERE (")(.+?)(") # C syntax
    | (\0<)(.+?)(\0>) # C alternate syntax
    | ()([\w:]+)(\b) # Perl and others
    / at lib/LXR/Lang.pm line 88.
    Compilation failed in require at lib/LXR/Common.pm line 50.
    Compilation failed in require at lib/LXR/Index.pm line 23.
    BEGIN failed--compilation aborted at lib/LXR/Index.pm line 23.
    Compilation failed in require at /var/www/html/lxr/genxref line 26.
    BEGIN failed--compilation aborted at /var/www/html/lxr/genxref line 26.

  • Andre-Littoz

    Andre-Littoz - 2011-04-12

    This incompatibility has been discovered last week (2011-04-05) by Dr. Martin Wilck.

    A new feature has been added in Perl after version 5.8.8 (which is probably yours). Mine is 5.12.3 and contains this feature.

    Your choice is:
    1/ upgrade Perl, or
    2/ read Help forum, topic Help on non-regression checks after modifications; towards the end, you'll find a dirty patch to get around this incompatibility.

    Please send feedback. If you think it worth, I can try to use alternate syntax since this part of the code is not fully satisfactory.


  • Andre-Littoz

    Andre-Littoz - 2012-08-03
    • status: open --> closed
  • Andre-Littoz

    Andre-Littoz - 2012-08-03

    Ships with release 1.0


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks