Thursday, June 05, 2008

lxml on OSX -- solved

Hi guys. I've been investigating building lxml on OSX for quite some time now.

Here's the scoop so far:
  • I want to use buildout
  • I want NOT to use Apple's libraries (libxml, libxslt)
  • On OSX there's no "--rpath" option available, thus there's no way to tell an executable on link time where to look for dynamic libraries
  • This is disgusting (do we have 2008 or what?)
Ok, that's what I've come up with. Note the z3c.recipe.egg, it allows for arguments to the setup script, which the original zc.recipe.egg does not. The version 2.0.6 of lxml has a fix for OSX in, which allows to do away with DYLD_LIBRARY_PATH, BUT you need a DYLD_FORCE_FLAT_NAMESPACE=1. Don't ask. I have no idea.
[lxml]
parts=
libxml2
libxslt
lxml-download
lxml-build

[libxml2]
recipe = zc.recipe.cmmi
url = http://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.26.tar.gz
extra_options = --without-python

[libxslt]
recipe = zc.recipe.cmmi
url = http://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/libxslt-1.1.16.tar.bz2
extra_options = --with-libxml-prefix=${buildout:directory}/parts/libxml2/
--without-python

[lxml-download]
recipe = plone.recipe.distros
urls = http://codespeak.net/lxml/lxml-2.0.6.tgz
version-suffix-packages = lxml-2.0.6.tgz

[lxml-build]
recipe = z3c.recipe.egg:setup
setup = ${lxml-download:location}/lxml
args =
clean
build
bdist_egg
--with-xslt-config=${buildout:directory}/parts/libxslt/bin/xslt-config
develop = true

You use it like:

[buildout]
extends=
lxml.cfg
parts=
${lxml:parts}
eggs=
${lxml:eggs}

Monday, May 19, 2008

lxml on OSX -- again

Hi folks :)

Today, I've again tried to install lxml on OS X. For a project I do for a customer (migrating featurecreep CMS sites to Plone), I use the lxml parser. I get regular segfaults, this time using python 2.4 (I use macport for python 2.4).
I investigated again, and came along this post. The scoop is:
after blood, sweat, and some tears (kidding) this is *all* I needed, it seems:

export CFLAGS="-flat_namespace"

...no static builds libxml2 libs, no buildout recipe. I just set that and ran:

python setup.py bdist_egg
--with-xml2-config=/opt/local/bin/xml2-config
--with-xslt-config=/opt/local/bin/xslt-config

which uses the libxml2 and etc. installed by ports. In fact, as long
as /opt/local/bin is on my path that should work without having to set
paths (i.e. from easy_install). All my tests that were segfaulting
are now passing. This appears to be the exact same behavior I got by
setting DYLD_FORCE_FLAT_NAMESPACE at runtime but without the side
affect of applying itself to anything else running in my shell ;)

so, I'm thinking this is just two lines of code added to cflags() ...

if sys.platform in ('darwin',):
result.append('-flat_namespace')


Well. What can I say. Interesting poinst so far for OS X development:
  • no -rpath supported
  • no static libraries (Yup! No joke)

Sunday, May 18, 2008

Read This Post!

I found this post quite educating.

Thursday, May 15, 2008

Aardvark bookmarklet

Duh.

One should read on, THEN post.

Aardvark for Safari --- sort of

Well, this might be old news for you, but by dragging the "run demo" link on the Aardvark home page to the Safari bookmark bar actually allows you to inject Aardvark to the page your're currently viewing.

I think that's cool and useful :)

incredible stuff

I've just found this incredible stuff on the web. I thought I just might blog about it.

git shelves
import gitshelve

data = gitshelve.open(repository = '/tmp/data.git')

data[key] = "Hello, world!"
Data.Sync()
del data[key]
data.close()

How cool is this? Distributed CMS someone?
Original post here. Git it here,
processing on **javascript**

This guy actually ported the processing language to Javascript.
Thats f***ing awesome!

Friday, May 09, 2008

LXML on OS X (again)

It seems that building lxml on Mac OS X is still a problem. I'm trying to use buildout as in:
[libxslt]
recipe = zc.recipe.cmmi
url = http://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/libxslt-1.1.16.tar.bz2
extra_options = --with-libxml-prefix=${buildout:directory}/parts/libxml2/
--without-python

[lxml]
recipe = zc.recipe.egg:custom
egg = lxml
include-dirs = ${buildout:directory}/parts/libxml2/include/libxml2
${buildout:directory}/parts/libxslt/include
library-dirs = ${buildout:directory}/parts/libxml2/lib
${buildout:directory}/parts/libxslt/lib
rpath = ${buildout:directory}/parts/libxml2/lib
${buildout:directory}/parts/libxslt/lib


That fails when buildout tries to build the lxml egg. Looking closely at the error, I discovered that despite pointing it at the libxslt built, it still uses the one found in /usr/lib.

To be more specific: lxml tries to find xslt-config, which is in $BO/parts/libxslt/bin/xslt-config, but of course finds the one in /usr/bin first.

What I'd like to do is to add something like:

# this would be needed but zc.recipe.egg:custom doesn't allow for that
# Doh.
extra_options= --with-xslt-config=${buildout:directory}/parts/libxslt/bin/xslt-config


That option is available in zc.recipe.cmmi, but not in zc.recipe.egg. Looking at custom.py there I sadly found no obvious way to add this as it uses some version of easy_install.

D'oh.

Possible solutions:
  • build egg manually, add to egg cache (yuck-bleah)
  • build manually for OS X, add to own egg server (yuck)
  • roll-my-own recipe (work)

Thursday, May 08, 2008

Use git -- have more fun.

Following this post, I was lured into trying the git svn backend. We're using SVN at our office for hysterical reasons and this seemed a good way to use git locally and svn as a backend.

So basically what you do is:
$ mkdir somedir
$ cd somedir
$ git-svn init -s $svnurl


That will initialize the git repository. The -s tells git-svn to assume the standard directory scheme for tags and branches, that is, below the svnurl  there should be a "tags", "branches", "releases". Now fetch the repo:
$ git-svn fetch
That'll suck all svn revisions to your local git repo.
Now hack away and use the usual git commands to check in locally.

Use something like gitNub to view the repository changes.

Enjoy :)

Wednesday, May 07, 2008

git +ssh on a mac using macports

To get git installed with subversion support using macports you need to do the following:
$ sudo port install git-core +ssh
Note the +ssh.

Yo! Back from NYC vudo sprint.

I'm still a bit exhausted from the coding marathon we did at the NYC vudo sprint.

We had a great time and I enjoyed pair programming with Malthe Borch very much.

We did some sort of ZODB abstraction using SQLAlchemy called z3c.dobbin. That is, z3c.dobbin uses the z3 schemata (interfaces!) to transparently create SQL tables. Each table will map to one single interface, and dobbin will join these tables based on a dynamically created mapper. That means, that every interface is available separately for doing SQL queries. This should allow for pretty fast and intuitive queries.

We're going to use a relatively new approach to editing web pages -- it'll be more page centric in contrast to being content type centric. There simply will not be any content types in vudo.

Also the skinning will be completely different -- we'll use the designed mock-ups directly, and we'll server them unaltered. That compares a little to deliverance, but only a little. We'll call these mock ups "layouts" and each page in vudo is associated with a lay out. These layouts define "regions", where vudo inserts rendered content at run time. All this is configured using a ZCML directive -- that is w/o touching the mock up, and w/o having the designer be forced to do special markup (e.g. using class prefixes or id prefixes).

I think that's cool :)

And I can't wait to replace this crappy blogging interface with vudo ...

iPhone Developer Program

Yes! I've got a mail from Apple that I'm accepted to the iPhone developer program!

I hope I can make my ideas become real -- I want to have a native front end on my iPhone
to the web framework I'm going to use Really Soon Now (TM).

Tuesday, April 22, 2008

Time passed ....

.... and things happened:
  • I was at the Plone Conference '07
  • I was at this year's Snow Sprint
And most exiting to me, I'll visit NYC the first time in my life to get hands on some really cool stuff.

I'm really into python and web programming now, leaving my old work behind.

Other than that, I've started (again) to work for zest to help paying bills.