Blame astrometry-Call-python-scripts-as-modules-instead-of-executables.patch

23dea7f
From: Ole Streicher <olebole@debian.org>
23dea7f
Date: Thu, 1 Dec 2016 21:18:56 +0100
23dea7f
Subject: Call python scripts as modules instead of executables
23dea7f
23dea7f
In Debian, the python scripts are not installed in /usr/bin, but are
23dea7f
only accessible as modules. Therefore, we need to replace the direct
23dea7f
call of the script by "python -m astrometry.$(MODULE)".
23dea7f
---
23dea7f
 blind/augment-xylist.c | 12 +++++++++---
23dea7f
 util/image2pnm.py      |  2 +-
23dea7f
 2 files changed, 10 insertions(+), 4 deletions(-)
23dea7f
23dea7f
diff --git a/blind/augment-xylist.c b/blind/augment-xylist.c
23dea7f
index 31bdd22..da0ea05 100644
23dea7f
--- a/blind/augment-xylist.c
23dea7f
+++ b/blind/augment-xylist.c
23dea7f
@@ -723,7 +723,9 @@ int augment_xylist(augment_xylist_t* axy,
23dea7f
                 sl_append_nocopy(tempfiles, pnmfn);
23dea7f
             }
23dea7f
 
23dea7f
-            append_executable(cmd, "image2pnm", me);
50e67bc
+	    append_executable(cmd, "python3", me);
23dea7f
+	    sl_append(cmd, "-m");
23dea7f
+	    sl_append(cmd, "astrometry.util.image2pnm");
23dea7f
             if (axy->extension) {
23dea7f
                 sl_append(cmd, "--extension");
23dea7f
                 sl_appendf(cmd, "%i", axy->extension);
23dea7f
@@ -1051,7 +1053,9 @@ int augment_xylist(augment_xylist_t* axy,
23dea7f
         }
23dea7f
         logverb("Removing lines of (spurious) sources from xylist \"%s\", writing to \"%s\"\n",
23dea7f
                 xylsfn, nolinesfn);
23dea7f
-        append_executable(cmd, "removelines", me);
50e67bc
+	append_executable(cmd, "python3", me);
23dea7f
+	sl_append(cmd, "-m");
23dea7f
+	sl_append(cmd, "astrometry.util.removelines");
23dea7f
         if (axy->xcol)
23dea7f
             sl_appendf(cmd, "-X %s", axy->xcol);
23dea7f
         if (axy->ycol)
23dea7f
@@ -1110,7 +1114,9 @@ int augment_xylist(augment_xylist_t* axy,
23dea7f
             unixylsfn = create_temp_file("uniform", axy->tempdir);
23dea7f
             sl_append_nocopy(tempfiles, unixylsfn);
23dea7f
         }
23dea7f
-        append_executable(cmd, "uniformize", me);
50e67bc
+	append_executable(cmd, "python3", me);
23dea7f
+	sl_append(cmd, "-m");
23dea7f
+	sl_append(cmd, "astrometry.util.uniformize");
23dea7f
         sl_appendf(cmd, "-n %i", axy->uniformize);
23dea7f
         if (axy->xcol)
23dea7f
             sl_appendf(cmd, "-X %s", axy->xcol);
23dea7f
diff --git a/util/image2pnm.py b/util/image2pnm.py
23dea7f
index de7e546..ee88efe 100755
23dea7f
--- a/util/image2pnm.py
23dea7f
+++ b/util/image2pnm.py
23dea7f
@@ -165,7 +165,7 @@ def image2pnm(infile, outfile, force_ppm=False, extension=None, mydir=None):
23dea7f
     if ext == fitsext and extension:
23dea7f
         cmd = an_fitstopnm_ext_cmd % extension
23dea7f
 
23dea7f
-    if ext == fitsext and mydir:
23dea7f
+    if False and ext == fitsext and mydir:
23dea7f
         # an-fitstopnm: add explicit path...
23dea7f
         cmd = find_program(mydir, cmd)
23dea7f
         if cmd is None: