[okl4-developer] OKL4 2.1: naming the build directory after themachine

Frank Kaiser frank.kaiser at opensynergy.com
Tue Jul 15 01:39:19 EST 2008


Hello

 

I think I've found a solution for my name clash problem. There is a way
to check what the dictionary of command line parameters returns. Classes
and some other types have the builtin attribute '__name__' to return the
object's name as a string:

        self.build_dir = handle_arg("BUILD_DIR", "#build")

        if hasattr(self.build_dir, "__name__"):

            self.build_dir = self.build_dir.__name__

This works for all 3 cases: naming the directory after the machine,
using another name, or not using the BUILD_DIR parameter.

Maybe there are other ways to fix the problem: proposal are welcome.

 

Regards

Frank

From: developer-bounces at okl4.org [mailto:developer-bounces at okl4.org] On
Behalf Of Frank Kaiser
Sent: Monday, July 14, 2008 2:39 PM
To: developer at okl4.org
Subject: [okl4-developer] OKL4 2.1: naming the build directory after
themachine

 

Hello

 

When I compile my new platform I tried to give the build directory the
same nam as the machine by invoking the build script this way:

tools/build.py MACHINE=sam9263 PROJECT=iguana BUILD_DIR=sam9263

However, that does not work. This is the response:

scons: Reading SConscript files ...

/home/fka/Projects/COQOS/L4/OKL4/okl4_2.1/tools/build.py:287 Error: type
object 'sam9263' has no attribute 'startswith'

Here the relevant lines of the script:

        def handle_arg(name, default):

            ret = kargs.get(name, default)

            if name in kargs: del kargs[name]

            return ret

 

        self.build_dir = handle_arg("BUILD_DIR", "#build")

        if not self.build_dir.startswith('#'):

            self.build_dir = '#' + self.build_dir

The only explanation for this odd error message is that 'sam9263' is not
treated as a string but as an object reference to the class 'sam9263'
defined in my platform script 'machines.py'. An attempt to quote the
BUILD_DIR parameter has no effect:

tools/build.py MACHINE=sam9263 PROJECT=iguana BUILD_DIR="sam9263"

The result is the same error.

Trying to convert the symbol 'sam9263' to a string by this assignment

        self.build_dir = str(handle_arg("BUILD_DIR", "#build"))

starts compilation into the directory <class 'machines.sam9263'>, which
is not what I want. Finally the build stops with an error message:

[IDL ] <class
'machines.sam9263'>/iguana_server/object/libs_iguana/include/interfaces/
iguana_serverloop.c

sh: class: No such file or directory

scons: *** [<class
'machines.sam9263'>/iguana_server/object/libs_iguana/include/interfaces/
iguana_serverloop.c] Error 1

scons: building terminated because of errors.

I think this is a specialty of Python. The keyword/value paring in a
dictionary apparently allows almost anything as a value, and if the
given value is the identifier of a class, then Python assumes that the
class is meant. That mechanism is quite effective when choosing the
hardware platform. First the script reads all available 'machines.py',
and then simply by using the class name with the MACHINE parameter the
platform to be compiled is selected.

So the question remains: has anyone an idea to enforce the string
treatment of the BUILD_DIR value?

 

Regards

Frank

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.okl4.org/pipermail/developer/attachments/20080714/a0f55328/attachment.htm 


More information about the Developer mailing list