Blob Blame Raw
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)".
---
 blind/augment-xylist.c | 12 +++++++++---
 util/image2pnm.py      |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/blind/augment-xylist.c b/blind/augment-xylist.c
index 31bdd22..da0ea05 100644
--- a/blind/augment-xylist.c
+++ b/blind/augment-xylist.c
@@ -723,7 +723,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);
@@ -1051,7 +1053,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)
@@ -1110,7 +1114,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 de7e546..ee88efe 100755
--- a/util/image2pnm.py
+++ b/util/image2pnm.py
@@ -165,7 +165,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: