use same Python version for autoimport and importpkg
authorHelmut Grohne <helmut@subdivi.de>
Sun, 1 May 2016 12:26:20 +0000 (14:26 +0200)
committerHelmut Grohne <helmut@subdivi.de>
Sun, 1 May 2016 12:26:20 +0000 (14:26 +0200)
The autoimport tool runs the Python interpreter explicitly. Instead of
invoking just "python" and thus calling whatever the current default is,
use sys.executable which is the interpreter used to run autoimport, thus
locking both to the same Python version.

autoimport.py

index 5f14b2e..0d26fe4 100755 (executable)
@@ -11,6 +11,7 @@ import optparse
 import os
 import sqlite3
 import subprocess
+import sys
 import tempfile
 try:
     from urllib.parse import unquote
@@ -64,7 +65,7 @@ def process_dir(pkgs, d):
 def process_pkg(name, pkgdict, outpath):
     filename = pkgdict["filename"]
     print("importing %s" % filename)
-    importcmd = ["python", "importpkg.py"]
+    importcmd = [sys.executable, "importpkg.py"]
     if "sha256hash" in pkgdict:
         importcmd.extend(["-H", pkgdict["sha256hash"]])
     if filename.startswith(("http://", "https://", "ftp://", "file://")):