From: Ole Streicher <olebole@debian.org>
Date: Thu, 1 Dec 2016 21:18:56 +0100
Subject: Call python scripts as modules instead of executables

In Debian, the python scripts are not installed in /usr/bin, but are
only accessible as modules. Therefore, we need to replace the direct
call of the script by "python -m astrometry.$(MODULE)".
---
 solver/augment-xylist.c | 12 +++++++++---
 util/image2pnm.py       |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/solver/augment-xylist.c b/solver/augment-xylist.c
index b5dbe91..6eda20f 100644
--- a/solver/augment-xylist.c
+++ b/solver/augment-xylist.c
@@ -728,7 +728,9 @@ int augment_xylist(augment_xylist_t* axy,
                 sl_append_nocopy(tempfiles, pnmfn);
             }
 
-            append_executable(cmd, "image2pnm", me);
+	    append_executable(cmd, "python3", me);
+	    sl_append(cmd, "-m");
+	    sl_append(cmd, "astrometry.util.image2pnm");
             if (axy->extension) {
                 sl_append(cmd, "--extension");
                 sl_appendf(cmd, "%i", axy->extension);
@@ -1053,7 +1055,9 @@ int augment_xylist(augment_xylist_t* axy,
         }
         logverb("Removing lines of (spurious) sources from xylist \"%s\", writing to \"%s\"\n",
                 xylsfn, nolinesfn);
-        append_executable(cmd, "removelines", me);
+	append_executable(cmd, "python3", me);
+	sl_append(cmd, "-m");
+	sl_append(cmd, "astrometry.util.removelines");
         if (axy->xcol)
             sl_appendf(cmd, "-X %s", axy->xcol);
         if (axy->ycol)
@@ -1112,7 +1116,9 @@ int augment_xylist(augment_xylist_t* axy,
             unixylsfn = create_temp_file("uniform", axy->tempdir);
             sl_append_nocopy(tempfiles, unixylsfn);
         }
-        append_executable(cmd, "uniformize", me);
+	append_executable(cmd, "python3", me);
+	sl_append(cmd, "-m");
+	sl_append(cmd, "astrometry.util.uniformize");
         sl_appendf(cmd, "-n %i", axy->uniformize);
         if (axy->xcol)
             sl_appendf(cmd, "-X %s", axy->xcol);
diff --git a/util/image2pnm.py b/util/image2pnm.py
index 9c275af..3ee8fa6 100755
--- a/util/image2pnm.py
+++ b/util/image2pnm.py
@@ -190,7 +190,7 @@ def image2pnm(infile, outfile, force_ppm=False, extension=None, mydir=None):
     if ext == fitsext and extension:
         cmd = an_fitstopnm_ext_cmd % extension
 
-    if ext == fitsext and mydir:
+    if False and ext == fitsext and mydir:
         # an-fitstopnm: add explicit path...
         cmd = find_program(mydir, cmd)
         if cmd is None:
