<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Guy Rutenberg &#187; KDevelop</title>
	<atom:link href="http://www.guyrutenberg.com/tag/kdevelop/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.guyrutenberg.com</link>
	<description>Keeping track of what I do</description>
	<lastBuildDate>Sat, 14 Jan 2012 11:30:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Convert KDevelop&#8217;s Source Archive to Source Package</title>
		<link>http://www.guyrutenberg.com/2007/07/26/convert-kdevelops-source-archive-to-source-package/</link>
		<comments>http://www.guyrutenberg.com/2007/07/26/convert-kdevelops-source-archive-to-source-package/#comments</comments>
		<pubDate>Thu, 26 Jul 2007 17:43:29 +0000</pubDate>
		<dc:creator>Guy</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[KDevelop]]></category>

		<guid isPermaLink="false">http://guy.sikumuna.com/2007/07/26/convert-kdevelops-source-archive-to-source-package/</guid>
		<description><![CDATA[I use KDevelop as my main IDE and I&#8217;m pretty satisfied. KDevelop can create a source archive of the project&#8217;s source code automatically for you which simplifies the distribution of the project. Unfortunately the archive created isn&#8217;t ready for distribution. The user can&#8217;t just run ./configure ; make as he needs to run all the [...]]]></description>
			<content:encoded><![CDATA[<p>I use KDevelop as my main IDE and I&#8217;m pretty satisfied. KDevelop can create a source archive of the project&#8217;s source code automatically for you which simplifies the distribution of the project. Unfortunately  the archive created isn&#8217;t ready for distribution. The user can&#8217;t just run <code>./configure ; make</code> as he needs to run all the automake tools before. Not ideal for distributing. So you need to convert this source archive to a source package which is ready for the user to compile immediately</p>
<p><span id="more-8"></span></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #483d8b;">&quot;&quot;&quot;
packsource.py
&nbsp;
Version: 1.0
&nbsp;
This script takes a tar.gz source archive created by KDevelop and turns
it into a source package, which the will be able just to use
./configure ; make ; make install
to build (instead of using autotools).
&nbsp;
Synopsis:
        python packsource.py SomeProject-1.4.tar.gz
&nbsp;
The SomeProject-1.4.tar.gz will be overwritten with a new tar containg
the source package.
&nbsp;
&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">###########################################################################</span>
 <span style="color: #808080; font-style: italic;">#   Copyright (C) 2007 by Guy Rutenberg                                   #</span>
 <span style="color: #808080; font-style: italic;">#   guyrutenberg@gmail.com                                                #</span>
 <span style="color: #808080; font-style: italic;">#                                                                         #</span>
 <span style="color: #808080; font-style: italic;">#   This program is free software; you can redistribute it and/or modify  #</span>
 <span style="color: #808080; font-style: italic;">#   it under the terms of the GNU General Public License as published by  #</span>
 <span style="color: #808080; font-style: italic;">#   the Free Software Foundation; either version 2 of the License, or     #</span>
 <span style="color: #808080; font-style: italic;">#   (at your option) any later version.                                   #</span>
 <span style="color: #808080; font-style: italic;">#                                                                         #</span>
 <span style="color: #808080; font-style: italic;">#   This program is distributed in the hope that it will be useful,       #</span>
 <span style="color: #808080; font-style: italic;">#   but WITHOUT ANY WARRANTY; without even the implied warranty of        #</span>
 <span style="color: #808080; font-style: italic;">#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #</span>
 <span style="color: #808080; font-style: italic;">#   GNU General Public License for more details.                          #</span>
 <span style="color: #808080; font-style: italic;">#                                                                         #</span>
 <span style="color: #808080; font-style: italic;">#   You should have received a copy of the GNU General Public License     #</span>
 <span style="color: #808080; font-style: italic;">#   along with this program; if not, write to the                         #</span>
 <span style="color: #808080; font-style: italic;">#   Free Software Foundation, Inc.,                                       #</span>
 <span style="color: #808080; font-style: italic;">#   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             #</span>
<span style="color: #808080; font-style: italic;">############################################################################</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>,<span style="color: #dc143c;">sys</span>,<span style="color: #dc143c;">shutil</span>,<span style="color: #dc143c;">tempfile</span>
&nbsp;
tempdir = <span style="color: #dc143c;">tempfile</span>.<span style="color: black;">mkdtemp</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Extracting source archive...&quot;</span>
args=<span style="color: black;">&#91;</span><span style="color: #483d8b;">'tar'</span>, <span style="color: #483d8b;">'-zxf'</span>, <span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'-C'</span>, tempdir<span style="color: black;">&#93;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">spawnvp</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">P_WAIT</span>, args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, args<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Source archive extracted&quot;</span>
&nbsp;
origpwd = <span style="color: #dc143c;">os</span>.<span style="color: black;">getcwd</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
dirlist = <span style="color: #dc143c;">os</span>.<span style="color: black;">listdir</span><span style="color: black;">&#40;</span>tempdir<span style="color: black;">&#41;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">chdir</span><span style="color: black;">&#40;</span>tempdir + <span style="color: #483d8b;">&quot;/&quot;</span> + dirlist<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
args=<span style="color: black;">&#91;</span><span style="color: #483d8b;">'aclocal'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Running&quot;</span>, <span style="color: #483d8b;">&quot; &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#41;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">spawnvp</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">P_WAIT</span>, args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, args<span style="color: black;">&#41;</span>
&nbsp;
args=<span style="color: black;">&#91;</span><span style="color: #483d8b;">'autoheader'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Running&quot;</span>, <span style="color: #483d8b;">&quot; &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#41;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">spawnvp</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">P_WAIT</span>, args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, args<span style="color: black;">&#41;</span>
&nbsp;
args=<span style="color: black;">&#91;</span><span style="color: #483d8b;">'libtoolize'</span>, <span style="color: #483d8b;">'--copy'</span>, <span style="color: #483d8b;">'--force'</span>, <span style="color: #483d8b;">'--automake'</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Running&quot;</span>, <span style="color: #483d8b;">&quot; &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">spawnvp</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">P_WAIT</span>, args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, args<span style="color: black;">&#41;</span>
&nbsp;
args=<span style="color: black;">&#91;</span><span style="color: #483d8b;">'automake'</span>, <span style="color: #483d8b;">'-a'</span>, <span style="color: #483d8b;">'-c'</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Running&quot;</span>, <span style="color: #483d8b;">&quot; &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">spawnvp</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">P_WAIT</span>, args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, args<span style="color: black;">&#41;</span>
&nbsp;
args=<span style="color: black;">&#91;</span><span style="color: #483d8b;">'autoconf'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Running&quot;</span>, <span style="color: #483d8b;">&quot; &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#41;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">spawnvp</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">P_WAIT</span>, args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, args<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Removing automake cache files&quot;</span>
<span style="color: #dc143c;">shutil</span>.<span style="color: black;">rmtree</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'autom4te.cache/'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #dc143c;">os</span>.<span style="color: black;">chdir</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'..'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Building source package&quot;</span>
&nbsp;
args=<span style="color: black;">&#91;</span><span style="color: #483d8b;">'tar'</span>, <span style="color: #483d8b;">'-zcf'</span>, <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</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>, dirlist<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">spawnvp</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">P_WAIT</span>, args<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>, args<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #dc143c;">shutil</span>.<span style="color: #dc143c;">copy</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</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>, origpwd<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #dc143c;">os</span>.<span style="color: black;">chdir</span><span style="color: black;">&#40;</span>origpwd<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Clearing up...&quot;</span>
<span style="color: #dc143c;">shutil</span>.<span style="color: black;">rmtree</span><span style="color: black;">&#40;</span>tempdir<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Done&quot;</span></pre></div></div>

<p>To use the script just call it and pass the source archive filename to the script as an argument. The script takes the source archive and overwrites it as a source package which will be easy for users to install.</p>
<h6>Update (16/9/2007)</h6>
<p> Removed an unneeded module dependency.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.guyrutenberg.com/2007/07/26/convert-kdevelops-source-archive-to-source-package/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.315 seconds -->

