Sfoglia il codice sorgente

Python: Dismiss local python installation if pip is not present (#1627)

* Python: Dismiss local python installation if pip is not present

* Update xmake.lua
Jérôme Leclercq 2 anni fa
parent
commit
da7167c03a
1 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. 13 1
      packages/p/python/xmake.lua

+ 13 - 1
packages/p/python/xmake.lua

@@ -87,11 +87,23 @@ package("python")
             if not result then
                 result = package:find_tool("python", opt)
             end
+            if result then
+                -- check if pip, setuptools and wheel are installed
+                local ok = try { function () 
+                    os.vrunv(result.program, {"-c", "import pip"})
+                    os.vrunv(result.program, {"-c", "import setuptools"})
+                    os.vrunv(result.program, {"-c", "import wheel"})
+                    return true
+                end}
+                if not ok then
+                    return false
+                end
+            end
             return result
         end
     end)
 
-    on_install("@windows", "@msys", "@cygwin", function (package)
+    on_install("@windows|x86", "@windows|x64", "@msys", "@cygwin", function (package)
         if package:version():ge("3.0") then
             os.cp("python.exe", path.join(package:installdir("bin"), "python3.exe"))
         else