<?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>Milton Soares Filho &#187; debian</title>
	<atom:link href="http://blog.msoares.pro.br/tags/debian/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.msoares.pro.br</link>
	<description>Random rants and SW developers' stuff</description>
	<lastBuildDate>Fri, 28 May 2010 14:42:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Python-Debian Packaging for Maemo</title>
		<link>http://blog.msoares.pro.br/archives/python-debian-packaging-for-maemo</link>
		<comments>http://blog.msoares.pro.br/archives/python-debian-packaging-for-maemo#comments</comments>
		<pubDate>Tue, 28 Apr 2009 23:23:05 +0000</pubDate>
		<dc:creator>milton</dc:creator>
				<category><![CDATA[Planet INdT]]></category>
		<category><![CDATA[CDBS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[devel]]></category>
		<category><![CDATA[Maemo]]></category>
		<category><![CDATA[Make]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://msoares.dreamhosters.com/?p=41</guid>
		<description><![CDATA[Packaging a software component made using python to a Maemo device could be easier, if CDBS cared about hand-held devices and their limitations.
Knowing that using setup.py was the Right Way of Doing It&#8482; for python applications I tried to push myself into making CDBS work together, but not without a little harassment.
First of all, such [...]]]></description>
			<content:encoded><![CDATA[<p>Packaging a software component made using python to a <a href="http://maemo.org/">Maemo</a> device could be easier, if <a href="http://build-common.alioth.debian.org/cdbs-doc.html">CDBS</a> cared about hand-held devices and their limitations.</p>
<p>Knowing that using <strong>setup.py</strong> was the <em>Right Way of Doing It</em>&trade; for python applications I tried to push myself into making CDBS work together, but not without a little harassment.</p>
<p>First of all, such scope-limited distributions tend to gather components in customized places as to promote integration between them or just in sake of a plain different organization. This difficulty can be overcome by using <code>pycentral</code> and including the following line at <code>debian/rules</code> file.</p>
<pre name="code" class="xml">
export DH_PYCENTRAL=nomove</pre>
<p>Just as the manpage says, this will prevent the build-system from moving the files from the selected install prefix to a central place (like <code>/usr/share/pycentral</code>).</p>
<p>Secondly, because of limited storage capacity and speed-up necessities, usually python components install just their <code>.pyo</code> files. This requirement made me struggle trough CDBS&#8217; <strong>python-distutils.mk</strong> source code in hope for a simple fix. The answer I&#8217;ve found was to overrule the python-install target with the following commands (look <a href="http://blog.msoares.pro.br/wp-content/uploads/2009/04/python-distutils.diff">here</a> for the diff).</p>
<pre name="code" class="xml">
define FIXUP_DIST
    -find $(DEB_DESTDIR) -name '*.py' -exec rm -f {} \;
    -find $(DEB_DESTDIR) -name '*.pyc' -exec rm -f {} \;
    -find $(DEB_DESTDIR) -name '*.egg-info' -type d -exec rm -rf {} \;
endef

ifeq (all, $(cdbs_python_module_arch))
common-install-arch common-install-indep:: python-install-py
python-install-py:
    cd $(DEB_SRCDIR) &#038;&#038; $(call cdbs_python_binary,python$(cdbs_python_compile_version)) $(DEB_PYTHON_SETUP_CMD) install --root=$(DEB_DESTDIR) $(DEB_PYTHON_INSTALL_ARGS_ALL)
    $(call FIXUP_DIST)
else
common-install-arch common-install-indep:: $(addprefix python-install-, $(cdbs_python_build_versions))
python-install-%:
    cd $(DEB_SRCDIR) &#038;&#038; $(call cdbs_python_binary,python$*) $(DEB_PYTHON_SETUP_CMD) install --root=$(DEB_DESTDIR) $(DEB_PYTHON_INSTALL_ARGS_ALL)
    $(call FIXUP_DIST)
endif # archall detection</pre>
<p>Let&#8217;s say it&#8217;s inside a file named <strong>debian/fixup.mk</strong>, then my complete <strong>debian/rules</strong> file would be like this.</p>
<pre name="code" class="xml">
#!/usr/bin/make -f

DEB_PYTHON_SYSTEM=pycentral

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk
include debian/fixup.mk

export DH_PYCENTRAL=nomove</pre>
<p>And this is the beauty of CDBS, a file which would be several lines long gets resumed to a few lines.</p>
<p>I&#8217;m still trying to find a way to make this code available for all my components without installing it to a globally reachable path, but did not find a thing such as a MAKEFILEPATH variable untill now. I guess a package like <strong>cdbs-maemo-dev.deb</strong> would be an appropriate place for stuff like this, but pushing it there is for another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.msoares.pro.br/archives/python-debian-packaging-for-maemo/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
