I got an error building py27-pytools because it tries to use distribute instead of setuptools.
$ port installed py27-setuptools
The following ports are currently installed:
py27-setuptools @0.7.4_0 (active)
$ sudo port -vs install py27-pytools
Password:
---> Computing dependencies for py27-pytools.
---> Fetching distfiles for py27-pytools
---> Verifying checksum(s) for py27-pytools
---> Checksumming pytools-2012.1.tar.gz
---> Extracting py27-pytools
---> Extracting pytools-2012.1.tar.gz
---> Configuring py27-pytools
---> Building py27-pytools
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz
Extracting in /tmp/tmpb3UAi5
Now working in /tmp/tmpb3UAi5/distribute-0.6.14
Building a Distribute egg in /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-pytools/py27-pytools/work/pytools-2012.1
Traceback (most recent call last):
File "setup.py", line 37, in <module>
exec(open(init_path).read(), d)
File "<string>", line 8, in <module>
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/setuptools/__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/setuptools/extension.py", line 2, in <module>
from setuptools.dist import _get_unpatched
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/setuptools/dist.py", line 6, in <module>
from setuptools.command.install import install
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/setuptools/command/__init__.py", line 8, in <module>
from setuptools.command import install_scripts
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/setuptools/command/install_scripts.py", line 3, in <module>
from pkg_resources import Distribution, PathMetadata, ensure_directory
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/pkg_resources.py", line 2691, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/pkg_resources.py", line 668, in subscribe
callback(dist)
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/pkg_resources.py", line 2691, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/pkg_resources.py", line 2192, in activate
self.insert_on(path)
File "/private/tmp/tmpb3UAi5/distribute-0.6.14/pkg_resources.py", line 2293, in insert_on
"with distribute. Found one at %s" % str(self.location))
ValueError: A 0.7-series setuptools cannot be installed with distribute. Found one at /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
...
The attached patch works for me to fix the problem.
I can't reproduce this problem on my system now anymore. py*-setuptools was replaced by py*-distribute, I guess that solved the issue.