<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.tinkernet.ca/index.php?action=history&amp;feed=atom&amp;title=IoT_-_Modular_-_Post-Compile.py</id>
	<title>IoT - Modular - Post-Compile.py - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tinkernet.ca/index.php?action=history&amp;feed=atom&amp;title=IoT_-_Modular_-_Post-Compile.py"/>
	<link rel="alternate" type="text/html" href="https://wiki.tinkernet.ca/index.php?title=IoT_-_Modular_-_Post-Compile.py&amp;action=history"/>
	<updated>2026-05-12T00:21:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.tinkernet.ca/index.php?title=IoT_-_Modular_-_Post-Compile.py&amp;diff=1586&amp;oldid=prev</id>
		<title>Tinker: Created page with &quot;&lt;syntaxhighlight lang=&quot;py&quot; line=&quot;1&quot;&gt; # #   For some strange reason, if the FinalBIN file does not exist yet, #   You have to do a &quot;Clean&quot; before &quot;Build&quot; or it doesn't get copi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.tinkernet.ca/index.php?title=IoT_-_Modular_-_Post-Compile.py&amp;diff=1586&amp;oldid=prev"/>
		<updated>2021-04-30T20:26:45Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;syntaxhighlight lang=&amp;quot;py&amp;quot; line=&amp;quot;1&amp;quot;&amp;gt; # #   For some strange reason, if the FinalBIN file does not exist yet, #   You have to do a &amp;quot;Clean&amp;quot; before &amp;quot;Build&amp;quot; or it doesn&amp;#039;t get copi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;py&amp;quot; line=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
#   For some strange reason, if the FinalBIN file does not exist yet,&lt;br /&gt;
#   You have to do a &amp;quot;Clean&amp;quot; before &amp;quot;Build&amp;quot; or it doesn't get copied...&lt;br /&gt;
#&lt;br /&gt;
#   If the file exists, it gets updated...&lt;br /&gt;
#&lt;br /&gt;
#   This is rather odd...&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;&amp;gt;---------- POST Compile Script BEGIN ----------&amp;lt;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Import(&amp;quot;env&amp;quot;, &amp;quot;projenv&amp;quot;)&lt;br /&gt;
from shutil import copyfile&lt;br /&gt;
&lt;br /&gt;
# Dump construction environments (for debug purpose)&lt;br /&gt;
# print(env.Dump())&lt;br /&gt;
# print(projenv.Dump())&lt;br /&gt;
&lt;br /&gt;
# access to global construction environment&lt;br /&gt;
# print(env)&lt;br /&gt;
&lt;br /&gt;
# print(&amp;quot;=======&amp;quot;)&lt;br /&gt;
# print(&amp;quot;BUILD FLAGS: &amp;quot;)&lt;br /&gt;
# print(env.ParseFlags(env['BUILD_FLAGS']))&lt;br /&gt;
# print(&amp;quot;=======&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
# access to project construction environment&lt;br /&gt;
# print(projenv)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Foo1 = env['PROGNAME'] + &amp;quot;.bin&amp;quot;&lt;br /&gt;
Foo2 = env['PIOENV'] + &amp;quot;.bin&amp;quot;&lt;br /&gt;
# FinalBIN = &amp;quot;Binaries/&amp;quot; + env['PIOENV'] + &amp;quot;.bin&amp;quot;&lt;br /&gt;
FinalBIN = &amp;quot;Distribution/&amp;quot; + env['PIOENV'] + &amp;quot;.bin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# print(Foo1, &amp;quot; --&amp;gt; &amp;quot;, Foo2, &amp;quot; ==&amp;gt; &amp;quot;, FinalBIN)&lt;br /&gt;
print(Foo1, &amp;quot; --&amp;gt; &amp;quot;, FinalBIN)&lt;br /&gt;
&lt;br /&gt;
def Copy_Binary(*args, **kwargs):&lt;br /&gt;
    print(&amp;quot;Copying binary to distribution directory...&amp;quot;, FinalBIN)&lt;br /&gt;
    target = str(kwargs['target'][0])&lt;br /&gt;
    copyfile(target, FinalBIN)&lt;br /&gt;
    print(&amp;quot;Done.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
env.AddPostAction(&amp;quot;$BUILD_DIR/${PROGNAME}.bin&amp;quot;, Copy_Binary)   #post action for .hex&lt;br /&gt;
&lt;br /&gt;
print(&amp;quot;&amp;gt;---------- POST Compile Script END ----------&amp;lt;&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tinker</name></author>
		
	</entry>
</feed>