Viktor Petersson logo

Blog

How to build Apache and mod_wsgi with Python 2.7 on FreeBSD

08 SEP • 2010 2 minutes

We’re probably not the only company switching to Python 2.7. Right now, we’re in the final phase of rolling out an updated version that uses Python 2.7. As I was setting up our servers, I ran into a few issues with packages who were hardcoded to use Python 2.6 or earlier.

Both Chronicle and YippieMove are using Django, and use on Apache with mod_wsgi. When building these two packages, we found out that were both hardcoded to use Python 2.6 or earlier. Fortunately, there’s a simple solution for it.

The first package is ‘dev/apr1′, one of Apache’s dependencies. To resolve this issue, simply edit ‘/usr/ports/dev/apr1/Makefile’. Find the line that says:

USE_PYTHON_BUILD= -2.6

and replace it with:

USE_PYTHON_BUILD= -2.7

The second application is mod_wsgi (www/mod_wsgi) itself. To resolve this edit ‘/usr/ports/www/mod_wsgi/Makefile‘ and change the line:

USE_PYTHON= 2.4-2.6

to

USE_PYTHON= 2.4-2.7

Both packages will compile just fine with Python 2.7, so no worries. I have notified both maintainers, but in the meantime, the above fix should do. Also, don’t forget to run ‘make clean’ before you try to rebuild the packages. Just for the record, we’re running FreeBSD 8.1 (AMD64), but that shouldn’t matter for the issue above.

Found an error or typo? File PR against this file.