Index: Portfile
===================================================================
--- Portfile	(revision 134624)
+++ Portfile	(working copy)
@@ -5,6 +5,7 @@
 PortGroup           python 1.0
 name                py-astropy
 version             1.0.1
+revision            1
 maintainers         robitaille
 
 dist_subdir         ${name}/${version}
@@ -48,21 +49,18 @@
     build.cmd  ${python.bin} setup.py --no-user-cfg --offline --no-git
     destroot.cmd  ${python.bin} setup.py --no-user-cfg --offline --no-git
 
+    # Don't let the python portgroup create symlinks to the binaries, because
+    # the python portgroup's post-destroot block will run before ours, so the
+    # files won't have the right names yet, and the symlinks will be broken.
+    python.link_binaries no
+
     post-destroot {
-        file rename ${destroot}${prefix}/bin/fitscheck-${python.branch} \
-                    ${destroot}${prefix}/bin/fitscheck-ap-${python.branch}
-        file rename ${destroot}${prefix}/bin/fitsdiff-${python.branch} \
-                    ${destroot}${prefix}/bin/fitsdiff-ap-${python.branch}
-        file rename ${destroot}${prefix}/bin/fitsheader-${python.branch} \
-                    ${destroot}${prefix}/bin/fitsheader-ap-${python.branch}
-        file rename ${destroot}${prefix}/bin/volint-${python.branch} \
-                    ${destroot}${prefix}/bin/volint-ap-${python.branch}
-        file rename ${destroot}${prefix}/bin/fits2bitmap-${python.branch} \
-                    ${destroot}${prefix}/bin/fits2bitmap-ap-${python.branch}
-        file rename ${destroot}${prefix}/bin/samp_hub-${python.branch} \
-                    ${destroot}${prefix}/bin/samp_hub-ap-${python.branch}
-        file rename ${destroot}${prefix}/bin/wcslint-${python.branch} \
-                    ${destroot}${prefix}/bin/wcslint-ap-${python.branch}
+        # Don't conflict with files installed by py-pyfits.
+        set ap_suffix -ap
+        foreach bin {fitscheck fitsdiff fitsheader volint fits2bitmap samp_hub wcslint} {
+            move ${destroot}${python.prefix}/bin/${bin} ${destroot}${python.prefix}/bin/${bin}${ap_suffix}
+            ln -s ${python.prefix}/bin/${bin}${ap_suffix} ${destroot}${prefix}/bin/${bin}${ap_suffix}${python.link_binaries_suffix}
+        }
     }
 
 }
