tag:blogger.com,1999:blog-5569894.post8386371019415289324..comments2023-11-08T13:18:07.006+00:00Comments on Distributed Memory: IronPython for build scriptingSteve Gilhamhttp://www.blogger.com/profile/03622573187942388226noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5569894.post-87178889893014905362009-07-20T09:51:00.739+01:002009-07-20T09:51:00.739+01:00"There's just something more appealing to..."There's just something more appealing to Python code over the angle brackets of MSBuild"<br /><br />Exactly. The Python code is imperative rather than declarative -- and a lot of the time that imperative nature is exactly what you want. <br /><br />Being able to script with a rich set XML handling APIs to hand means that even where you absolutely have to use the declarative XML forms (MSBuild and Wix, rather than Ant, in my case) for building, you can treat them as data in the steps before you actually use them.<br /><br />You can turn the Python scripts into a semi-declarative style backed by generative code as well. The declarative parts are project specific modules that just consist of lists or dicts defining data that are then imported by a reusable generator script, e.g. along the lines of<br /><br />"for each file (key) in imported dict X of deliverable files, generate a Wix component entity, and append it to the directory node with which it is associated by the mapping"Steve Gilhamhttps://www.blogger.com/profile/03622573187942388226noreply@blogger.comtag:blogger.com,1999:blog-5569894.post-36606516026611397282009-07-17T23:19:56.402+01:002009-07-17T23:19:56.402+01:00Ah, yes. Using Python as a build tool brings back ...Ah, yes. Using Python as a build tool brings back good memories.<br /><br />Back in the day, before MSBuild and IronPython, I wrote a build script in regular Python. It was my team's first and crude attempt at continuous integration:<br /><br /><a href="http://www.bugfree.dk/blog/2006/01/04/being-a-functional-pythonian/" rel="nofollow">http://www.bugfree.dk/blog/2006/01/04/being-a-functional-pythonian</a><br /><br />My Python build system replaced a series of batch files that did looping, called out to external commands, and did their best at checking for errors along the way. While the batch files worked most of the time, they were in trouble whenever a command didn't signal success or failure using the proper exit codes. Not to mention that large batch files are a nightmare to debug.<br /><br />But using Python I could parse stdout/stderr, look at the file system, or whatever to assert success.<br /><br />There's just something more appealing to Python code over the angle brackets of MSBuild or NAnt configuration files, and defining custom build tasks in .Net.<br /><br />The Ruby guys have long used Rake to express makefiles in Ruby, but I don't believe Python have something equally popular.Unknownhttps://www.blogger.com/profile/00952709457053974061noreply@blogger.com