<?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>pushin&#039; and poppin&#039; your eax</title>
	<atom:link href="http://blog.mahmoudimus.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mahmoudimus.com</link>
	<description>hacker indulgence</description>
	<lastBuildDate>Fri, 22 Jan 2010 08:35:05 +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 2.6.4 and Twisted 9 on OS X 10.6 Snow Leopard</title>
		<link>http://blog.mahmoudimus.com/2009/12/python-2-6-4-and-twisted-9-on-os-x-10-6-snow-leopard/</link>
		<comments>http://blog.mahmoudimus.com/2009/12/python-2-6-4-and-twisted-9-on-os-x-10-6-snow-leopard/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 07:06:33 +0000</pubDate>
		<dc:creator>Mahmoud</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[snow-leopard]]></category>
		<category><![CDATA[twisted]]></category>

		<guid isPermaLink="false">http://blog.mahmoudimus.com/?p=73</guid>
		<description><![CDATA[I just recently purchased a MacBook Pro, which comes with Snow Leopard installed, and I noticed that it comes with python 2.6.1 installed. I wanted to upgrade to the latest python release of 2.6.4, so I tried installing the official python Mac OS distribution from python.org. After installation, I wanted to install Twisted and I [...]]]></description>
			<content:encoded><![CDATA[<p>I just recently purchased a MacBook Pro, which comes with Snow Leopard installed, and I noticed that it comes with python 2.6.1 installed. I wanted to upgrade to the latest python release of 2.6.4, so I tried installing the official python Mac OS distribution from python.org. After installation, I wanted to install <a title="Twisted, the most popular async I/O library for python" href="http://twistedmatrix.com/trac/" target="_blank">Twisted</a> and I kept getting this error below:</p>
<pre class="brush: plain; gutter: false;">
creating build/temp.macosx-10.3-fat-2.6
creating build/temp.macosx-10.3-fat-2.6/twisted
creating build/temp.macosx-10.3-fat-2.6/twisted/runner
gcc-4.0 -arch ppc -arch i386 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c twisted/runner/portmap.c -o build/temp.macosx-10.3-fat-2.6/twisted/runner/portmap.o
In file included from /usr/include/architecture/i386/math.h:626,
 from /usr/include/math.h:28,
 from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyport.h:235,
 from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:58,
 from twisted/runner/portmap.c:10:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target &lt; 10.4 is invalid.
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/MacOSX10.4u.sdk
Please check your Xcode installation
gcc-4.0 -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.6/twisted/runner/portmap.o -o build/lib.macosx-10.3-fat-2.6/twisted/runner/portmap.so
ld: library not found for -lbundle1.o
ld: library not found for -lbundle1.o
collect2: ld returned 1 exit status
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/T6/T6diKRiFGJSwsabKP4864E+++TI/-Tmp-//ccIK1c3K.out (No such file or directory)
error: command 'gcc-4.0' failed with exit status 1
</pre>
<p>Something&#8217;s not right &#8212; setuptools is detecting that I&#8217;m using macosx-10.3, but I&#8217;m using Mac OS X 10.6.  Why is it that setuptools also wants to use /Developer/SDKs/MacOS10.4u.sdk to build python extensions? I&#8217;m currently using the SDK for Mac OS X 10.6, and I don&#8217;t want to install another SDK.</p>
<p>Well, I did a little bit of research and I learned that PSF&#8217;s 2.6.4 python package for a Mac is built with an option called &#8211;enable-universalsdk which, according to the <a title="PSF Mac Readme" href="http://svn.python.org/projects/python/trunk/Mac/README" target="_blank">readme</a>, defaults to /Developer/SDKs/MacOSX.10.4u.sdk. This is why building third-party extensions tries to reference the 10.4 SDK.</p>
<p>I was able to build python successfully using the following:</p>
<pre class="brush: bash; gutter: false;">
./configure --enable-framework --enable-universalsdk=/Developer/SDKs/MacOSX10.6.sdk/ --with-universal-archs=intel
make &amp;&amp; make test
sudo make install
</pre>
<p>You&#8217;ll notice that the following 3 tests failed when attempting to run the unit tests:</p>
<ul>
<li>asyncore</li>
<li>test_platform</li>
<li>test_macostools</li>
</ul>
<p>The test that should really put you on alert is asyncore. After doing some <a title="research on why the asyncore test fails on mac os x" href="http://bugs.python.org/issue5798" target="_blank">research</a>, it turns out the asyncore module is using some variant of select.poll(), which isn&#8217;t supported by the FreeBSD kernel. FreeBSD uses something called kqueue, which is what the test doesn&#8217;t take into account. To fix this, I pulled the <a title="asyncore module r73184" href="http://svn.python.org/view/*checkout*/python/trunk/Lib/asyncore.py?revision=73184&amp;content-type=text%2Fplain" target="_blank">asyncore.py</a> module from the trunk and overwrote /Lib/asyncore.py. The tests passed then.</p>
<p>You don&#8217;t need to fix the other two, as they only pertain to fixing the actual tests themselves instead of having to actually change a module. If you&#8217;re interested though, fixing &#8220;test_platform&#8221; follows the same pattern as asyncore. <a title="Brett Cannon" href="http://sayspy.blogspot.com/" target="_blank">Brett Cannon</a> actually <a href="http://bugs.python.org/issue6806" target="_blank">filed a bug</a> for this test and <a title="patch to fix test_platform by Brett Cannon" href="http://svn.python.org/view/python/trunk/Lib/test/test_platform.py?r1=73714&amp;r2=74640&amp;pathrev=74640" target="_blank">submitted a patch</a>, but you will still need to replace the entire test_platform.py module to get it working. Apparently, this patch is for python v2.7, v3.1, and v3.2. To fix it, download the patched <a title="patched test_platform.py" href="http://svn.python.org/view/*checkout*/python/trunk/Lib/test/test_platform.py?revision=74640&amp;content-type=text%2Fplain" target="_blank">test_platform.py</a> module and replace it with the one in /Lib/test/test_platform.py. Make sure you also delete /Lib/test/test_platform.pyc.</p>
<p>The last test, test_macostools, is actually quite interesting. Apparently, <a title="reason for why this test is failing" href="http://bugs.python.org/issue7041" target="_blank">Apple does not supply 64-bit versions of the Carbon frameworks used by these modules</a>. This is why this test is failing. Looks like there might not be a way to fix this test until Apple upgrades the Carbon frameworks to 64-bit usage.</p>
<p>After fixing these bugs, make sure you run the following command:</p>
<pre class="brush: bash; gutter: false;">
sudo make install
</pre>
<p>Needless to say, after I installed python with the options above, and after I fixed all these modules, the Twisted 9.0 installation was successful.</p>
<p>I hope this helps some of you in case you run into this problem!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2009/12/python-2-6-4-and-twisted-9-on-os-x-10-6-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Verifying Python64 builds</title>
		<link>http://blog.mahmoudimus.com/2009/07/verifying-python64-builds/</link>
		<comments>http://blog.mahmoudimus.com/2009/07/verifying-python64-builds/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 15:24:01 +0000</pubDate>
		<dc:creator>mahmoud</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[32bit]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[verification]]></category>

		<guid isPermaLink="false">http://blog.mahmoudimus.com/?p=10</guid>
		<description><![CDATA[At work, I&#8217;m migrating over python to our 64bit machines and one thing that I&#8217;ve noticed was that there really was no standard python 64bit verification method to ensure the build was really 64bit or not. I&#8217;ve read somewhere previously, especially for the Mac OS X crowd, that the LDFLAGS=&#8221;-arch x86_64&#8243; flag had to be [...]]]></description>
			<content:encoded><![CDATA[<p>At work, I&#8217;m migrating over <a title="Python" href="http://www.python.org/" target="_blank">python </a>to our 64bit machines and one thing that I&#8217;ve noticed was that there really was no standard python 64bit verification method to ensure the build was really 64bit or not. I&#8217;ve read <a title="somewhere" href="http://www.corepy.org/wiki/index.php?title=How_To_Build_a_64-bit_Python_and_use_Corepy/x86_64_on_OSX" target="_blank">somewhere</a> previously, especially for the Mac OS X crowd, that the LDFLAGS=&#8221;-arch x86_64&#8243; flag had to be passed in before building on a 64bit machine.</p>
<p>It looks like python2.6 changed the way it was required to build respective 64bit binaries. To build on standard linux x86_64 architecture, the following standard steps to installing on a 64bit machine worked for me:</p>
<pre class="brush: bash;">
./configure
make &amp;&amp; make test
make install
</pre>
<p>Surprisingly, I received a segmentation fault when building as well as testing. I&#8217;ve never seen this before, but for those of you who are interested, the error message was:</p>
<pre class="brush: bash;">
Parser/pgen ./Grammar/Grammar ./Include/graminit.h ./Python/graminit.c
make: *** [Include/graminit.h] Segmentation fault
Parser/pgen ./Grammar/Grammar ./Include/graminit.h ./Python/graminit.c
make: *** [Python/graminit.c] Segmentation fault
</pre>
<p>The verification step is actually pretty intuitive. An easy test to verify that you&#8217;re on a 64bit machine is to find the size of the MAX_INT. Luckily for us, python makes this a very easy verification.</p>
<p>To verify the build, I went on a regular python 32bit machine and I did:</p>
<pre class="brush: python;">
h[1] &gt;&gt;&gt; import sys
h[1] &gt;&gt;&gt; sys.maxint
2147483647
</pre>
<p>On a 64bit machine, I did:</p>
<pre class="brush: python;">
h[2] &gt;&gt;&gt; import sys
h[2] &gt;&gt;&gt; sys.maxint
9223372036854775807
</pre>
<p>Clearly, my 64bit installation worked:)</p>
<p>Hope this helps some of you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2009/07/verifying-python64-builds/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>python -c &#8216;print &#8220;hello world!&#8221; &#8216;</title>
		<link>http://blog.mahmoudimus.com/2009/07/hello-world/</link>
		<comments>http://blog.mahmoudimus.com/2009/07/hello-world/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 20:19:19 +0000</pubDate>
		<dc:creator>mahmoud</dc:creator>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[canonical]]></category>
		<category><![CDATA[hello]]></category>
		<category><![CDATA[jVI]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[musings]]></category>
		<category><![CDATA[natural language processing]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[nlp]]></category>
		<category><![CDATA[statistics]]></category>
		<category><![CDATA[vocabulary]]></category>
		<category><![CDATA[world]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://mahmoudimus.com/blog/?p=1</guid>
		<description><![CDATA[And so, we meet again, world. I&#8217;ve finally gotten around to registering a home online, installing Wordpress, and ready to share my ideas with the world. I&#8217;ve given a lot of topics some thought, and I think I might be able to influence and/or help others with my various migrations.
First, I&#8217;d like to thank Canonical [...]]]></description>
			<content:encoded><![CDATA[<p>And so, we meet again, world. I&#8217;ve finally gotten around to registering a home online, installing Wordpress, and ready to share my ideas with the world. I&#8217;ve given a lot of topics some thought, and I think I might be able to influence and/or help others with my various migrations.</p>
<p>First, I&#8217;d like to thank Canonical for Ubuntu and making my migration from Windows to Linux desktop. Some kinks here, and there, but overall I think that it was pretty flawless. I&#8217;ve also started a large push towards using vim as my primary editor, instead of constantly switching between IDEs. I believe Netbeans 6.7 came out, I haven&#8217;t had the opportunity to play around with it, but if it was anything like Netbeans 6.5, then hey, that&#8217;s +1 for them! What a great IDE, especially with the fantastic jVI extension.</p>
<p>I&#8217;ll update various posts here and there with some musings about python (what a language), some software releases, mathematical musings, natural language processing tidbits (including really cool algorithms to generate domain names), and various interesting ideas that I&#8217;ve had some time to play around with.</p>
<p>A primary reason for starting up this blog is to share with the world some of my thoughts, improve my writing, and try to contribute to the open source world. I think there&#8217;s a lot of work to do and I can NOT wait to start. Well world, I&#8217;ll hope to speak to you soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mahmoudimus.com/2009/07/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
