<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Paver Patterns 1: Attach git branch to version number</title>
	<atom:link href="http://goldenspud.com/rotr/index.php/2009/04/14/paver-patterns-1-attach/feed/" rel="self" type="application/rss+xml" />
	<link>http://goldenspud.com/rotr/index.php/2009/04/14/paver-patterns-1-attach/</link>
	<description></description>
	<lastBuildDate>Fri, 14 May 2010 16:50:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kevin Dangoor</title>
		<link>http://goldenspud.com/rotr/index.php/2009/04/14/paver-patterns-1-attach/comment-page-1/#comment-41064</link>
		<dc:creator>Kevin Dangoor</dc:creator>
		<pubDate>Wed, 15 Apr 2009 13:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://goldenspud.com/rotr/?p=140#comment-41064</guid>
		<description>Oops... I just realized that I never went back and updated compute_version to actually return the proper version number (either options.version_base or the extended version number you provide). I&#039;ll leave that as an exercise for the reader ;)</description>
		<content:encoded><![CDATA[<p>Oops&#8230; I just realized that I never went back and updated compute_version to actually return the proper version number (either options.version_base or the extended version number you provide). I&#8217;ll leave that as an exercise for the reader ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Dangoor</title>
		<link>http://goldenspud.com/rotr/index.php/2009/04/14/paver-patterns-1-attach/comment-page-1/#comment-41062</link>
		<dc:creator>Kevin Dangoor</dc:creator>
		<pubDate>Wed, 15 Apr 2009 13:08:02 +0000</pubDate>
		<guid isPermaLink="false">http://goldenspud.com/rotr/?p=140#comment-41062</guid>
		<description>Hey, thanks for the article! Great to see the way people are using Paver.

You could potentially automate this in a &quot;release&quot; task. Create a DEV.txt or similar that says something like &quot;This is unreleased development code. Good luck!&quot;. Commit that to the repository. Here is pseudocode for how you&#039;d do the rest:

&lt;pre lang=&quot;python&quot;&gt;
    def compute_version():
      if options.dev_file.exists():
          try:
              git_head_path = path(&#039;.git/HEAD&#039;)
              contents = git_head_path.open(&#039;rU&#039;).readline().strip()
              name, value = contents.split()
              BRANCH = value.split(&#039;/&#039;)[-1]
              if BRANCH != &#039;master&#039;:
                  VERSION += &#039;-&#039; + BRANCH
          except:
              pass
          VERSION += &#039;-dev&#039;
    

    options(
        version_base=&quot;1.2.3&quot;,
        dev_file=path(&#039;DEV.txt&#039;)
    )

    setup(
        name=&#039;MyProject&#039;,
        version=compute_version
    )

    @task
    def release(options):
        dev_file.copy(&quot;DEV-backup.txt&quot;)
        # not totally familiar with git... this command may be a little different
        sh(&quot;git rm %s&quot; % dev_file)
        # build the distribution
        call_task(&#039;sdist&#039;)
        sh(&quot;git commit -a -m &#039;tagging release&#039;&quot;)
        sh(&quot;git tag %s&quot; % options.setup.version)
        # do tags need to be committed? beats me ;)
        path(&quot;DEV-backup.txt&quot;).move(dev_file)
        sh(&quot;git add %s&quot; % dev_file)
        sh(&quot;git commit -a -m &#039;marking new development&#039;&quot;)
&lt;/pre&gt;

This is not necessarily the most elegant way to do it, but you get the idea. At least you don&#039;t need to manually run through these steps each time.</description>
		<content:encoded><![CDATA[<p>Hey, thanks for the article! Great to see the way people are using Paver.</p>
<p>You could potentially automate this in a &#8220;release&#8221; task. Create a DEV.txt or similar that says something like &#8220;This is unreleased development code. Good luck!&#8221;. Commit that to the repository. Here is pseudocode for how you&#8217;d do the rest:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">    <span style="color: #ff7700;font-weight:bold;">def</span> compute_version<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
      <span style="color: #ff7700;font-weight:bold;">if</span> options.<span style="color: black;">dev_file</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
          <span style="color: #ff7700;font-weight:bold;">try</span>:
              git_head_path = path<span style="color: black;">&#40;</span><span style="color: #483d8b;">'.git/HEAD'</span><span style="color: black;">&#41;</span>
              contents = git_head_path.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'rU'</span><span style="color: black;">&#41;</span>.<span style="color: #dc143c;">readline</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
              name, value = contents.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
              BRANCH = value.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
              <span style="color: #ff7700;font-weight:bold;">if</span> BRANCH <span style="color: #66cc66;">!</span>= <span style="color: #483d8b;">'master'</span>:
                  VERSION += <span style="color: #483d8b;">'-'</span> + BRANCH
          <span style="color: #ff7700;font-weight:bold;">except</span>:
              <span style="color: #ff7700;font-weight:bold;">pass</span>
          VERSION += <span style="color: #483d8b;">'-dev'</span>
&nbsp;
&nbsp;
    options<span style="color: black;">&#40;</span>
        version_base=<span style="color: #483d8b;">&quot;1.2.3&quot;</span>,
        dev_file=path<span style="color: black;">&#40;</span><span style="color: #483d8b;">'DEV.txt'</span><span style="color: black;">&#41;</span>
    <span style="color: black;">&#41;</span>
&nbsp;
    setup<span style="color: black;">&#40;</span>
        name=<span style="color: #483d8b;">'MyProject'</span>,
        version=compute_version
    <span style="color: black;">&#41;</span>
&nbsp;
    @task
    <span style="color: #ff7700;font-weight:bold;">def</span> release<span style="color: black;">&#40;</span>options<span style="color: black;">&#41;</span>:
        dev_file.<span style="color: #dc143c;">copy</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;DEV-backup.txt&quot;</span><span style="color: black;">&#41;</span>
        <span style="color: #808080; font-style: italic;"># not totally familiar with git... this command may be a little different</span>
        sh<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;git rm %s&quot;</span> <span style="color: #66cc66;">%</span> dev_file<span style="color: black;">&#41;</span>
        <span style="color: #808080; font-style: italic;"># build the distribution</span>
        call_task<span style="color: black;">&#40;</span><span style="color: #483d8b;">'sdist'</span><span style="color: black;">&#41;</span>
        sh<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;git commit -a -m 'tagging release'&quot;</span><span style="color: black;">&#41;</span>
        sh<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;git tag %s&quot;</span> <span style="color: #66cc66;">%</span> options.<span style="color: black;">setup</span>.<span style="color: black;">version</span><span style="color: black;">&#41;</span>
        <span style="color: #808080; font-style: italic;"># do tags need to be committed? beats me ;)</span>
        path<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;DEV-backup.txt&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">move</span><span style="color: black;">&#40;</span>dev_file<span style="color: black;">&#41;</span>
        sh<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;git add %s&quot;</span> <span style="color: #66cc66;">%</span> dev_file<span style="color: black;">&#41;</span>
        sh<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;git commit -a -m 'marking new development'&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>This is not necessarily the most elegant way to do it, but you get the idea. At least you don&#8217;t need to manually run through these steps each time.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
