<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=DE link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>Hello<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span lang=EN-US>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:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>tools/build.py
MACHINE=sam9263 PROJECT=iguana BUILD_DIR=sam9263<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>However, that does not work. This is the
response:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons: Reading
SConscript files ...<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>/home/fka/Projects/COQOS/L4/OKL4/okl4_2.1/tools/build.py:287
Error: type object 'sam9263' has no attribute 'startswith'<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Here the relevant lines of the script:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
def handle_arg(name, default):<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US> ret
= kargs.get(name, default)<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
if name in kargs: del kargs[name]<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
return ret<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
self.build_dir = handle_arg("BUILD_DIR", "#build")<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
if not self.build_dir.startswith('#'):<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
self.build_dir = '#' + self.build_dir<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>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:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>tools/build.py
MACHINE=sam9263 PROJECT=iguana BUILD_DIR=”sam9263”<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>The result is the same error.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Trying to convert the symbol ‘sam9263’
to a string by this assignment<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>
self.build_dir = str(handle_arg("BUILD_DIR", "#build"))<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>starts compilation into the directory <i><class
'machines.sam9263'></i>, which is not what I want. Finally the build stops
with an error message:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>[IDL ] <class
'machines.sam9263'>/iguana_server/object/libs_iguana/include/interfaces/iguana_serverloop.c<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>sh: class: No
such file or directory<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons: ***
[<class
'machines.sam9263'>/iguana_server/object/libs_iguana/include/interfaces/iguana_serverloop.c]
Error 1<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>scons: building
terminated because of errors.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>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.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>So the question remains: has anyone an idea
to enforce the string treatment of the BUILD_DIR value?<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Regards<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US>Frank<o:p></o:p></span></p>
</div>
</body>
</html>