Re: 3 aap suggestions
Pavol Juhas <[email protected]> Sat, 26 Nov 2005 20:13:29 -0500
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Nov 26, 2005 at 03:26:33PM +0100, Bram Moolenaar wrote: > > Pavol Juhas wrote: > > > I have been using aap (version 1.079) for some time and I am quite > > impressed. However, there are few things that could be improved: > > > > (1) aap is not using correct linker when linking c++ objects. > > ... > > > > Can this be fixed so that aap uses g++ as a linker when linking c++ objects? > > This is a known problem: Object files as such don't have an indication > that they come from a C++ file. It works when Aap also does the > compilation, because an attribute is added to the object file then. > > A solution would be to store the attributes for the object file in the > signature file AAPDIR/sign. That's not a small change though... Another solution may be to make aap remember what kind of files it checked to determine if the objects in AAPDIR are up-to-date. Even when hello.o exists, aap has to check before linking if it is consistent with hello.cpp. Does aap know at that stage that it would use g++ to update hello.o if it is old? If yes, maybe it can keep that information and use g++ for linking. > > > (2) :toolsearch raises exception when it cannot find some tool. > > > > I am running my code on 2 different architectures - on the group linux > > box and on university x86_64 high-performance linux cluster. The later > > system has Intel c-compiler, which is not available on the group > > machine. I created new tools file, intelcc.py, put it to the > > ~/.aap/tools directory on cluster and used > > > > :toolsearch intelcc gcc > > > > in my main.aap. I thought this would work on both systems and aap would > > choose gcc if intelcc was not defined. However aap raises an exception > > and dies if it cannot find intelcc.py > > What is the exception? ImportError: No module named intelcc. I think aap should catch and ignore this exception and continue searching for other tools. Exception should be raised when :toolsearch cannot find any tool at all. > > (3) when ~/.aap/tools contains some files, aap ignores default tools in > > /usr/local/share/aap/tools > > > > doc/aap/ref-commands.html#cmd-usetool says that 3 directories are > > searched for compiler tools, and they must contain __init__.py. In > > fact only one directory is searched. Python uses for all imports the > > first package directory that contains __init__.py, therefore aap can > > find only tools in ~/.aap/tools, and the remaining directories are > > ignored. I think the solution would be to add all tools directories > > into sys.path (maybe only temporarily inside toolsearch or usetool > > functions) or to use lower-level python import statements, so that all > > tools directories could be searched. > > Aap already uses sys.path to do this. I can't say why it doesn't work > for you... If you know a bit of python, look in the Commands.py file, > the aap_toolsearch() function. The problem is that when python loads a module from package, it will always use the first package directory that it finds in sys.path. Therefore if ~/.aap/tools contains __init__.py and intelcc.py, aap can only find intelcc, because python would always import from ~/.aap/tools. A solution is to use the imp module which allows more control over what is imported. Attached are patches for problems (2) and (3) with respect to the latest cvs version. They seem to fix both issues. Cheers, Pavol ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click