<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>&nbsp;</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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
def handle_arg(name, default):<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ret
= kargs.get(name, default)<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return ret<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
self.build_dir = handle_arg(&quot;BUILD_DIR&quot;, &quot;#build&quot;)<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if not self.build_dir.startswith('#'):<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
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 &#8216;sam9263&#8217; is not treated as a string but as an object
reference to the class &#8216;sam9263&#8217; defined in my platform script &#8216;machines.py&#8217;.
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=&#8221;sam9263&#8221;<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 &#8216;sam9263&#8217;
to a string by this assignment<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
self.build_dir = str(handle_arg(&quot;BUILD_DIR&quot;, &quot;#build&quot;))<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US>starts compilation into the directory <i>&lt;class
'machines.sam9263'&gt;</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 ] &lt;class
'machines.sam9263'&gt;/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: ***
[&lt;class
'machines.sam9263'&gt;/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 &#8216;machines.py&#8217;, 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>&nbsp;</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>