Handling of Python import
Brought to you by:
ajlittoz
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
David, please could you provide some examples of when the import statements aren't linking to the included file.
sample output file
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.
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.
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).
Reopened manually after automatic close.
To be put on "todo" list for a coming release
Testing the patch is also on my todo list. Hopefully I'll have a chance to test this next week.
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.
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.
Regards
Ships with release 1.0