install pip for python

pull/18/head
ruki 6 years ago
parent 67be72f428
commit 064a91a7a9
No known key found for this signature in database
GPG Key ID: 33341DF9719963FA
  1. 13
      packages/p/python/xmake.lua
  2. 13
      packages/p/python2/xmake.lua

@ -83,6 +83,11 @@ package("python")
import("package.tools.autoconf").configure(package, configs, {envs = {PYTHONHOME = "", PYTHONPATH = ""}})
os.vrunv("make", {"install", "-j4", "PYTHONAPPSDIR=" .. package:installdir()})
-- set python environments
local version = package:version()
local envs = {PYTHONPATH = package:installdir("lib", "python" .. version:major() .. "." .. version:minor(), "site-packages")}
package:addenv("PYTHONPATH", envs.PYTHONPATH)
-- install resources
local resources =
{
@ -112,10 +117,16 @@ package("python")
assert(resource.sha256 == hash.sha256(resourcefile), "resource(%s): unmatched checksum!", name)
assert(archive.extract(resourcefile, resourcedir), "resource(%s): extract failed!", name)
local setupfile = assert(find_file("setup.py", path.join(resourcedir, "*")), "resource(%s): setup.py not found!", name)
os.vrunv("python", {setupfile, "install"})
local oldir = os.cd(path.directory(setupfile))
os.vrunv("python", {"setup.py", "install", "--prefix=" .. package:installdir()}, {envs = envs})
os.cd(oldir)
end
end)
on_test(function (package)
os.vrun("python --version")
os.vrun("python -c \"import ssl\"")
os.vrun("python -c \"import pip\"")
os.vrun("python -c \"import setuptools\"")
os.vrun("python -c \"import wheel\"")
end)

@ -56,6 +56,11 @@ package("python2")
import("package.tools.autoconf").configure(package, configs, {envs = {PYTHONHOME = "", PYTHONPATH = ""}})
os.vrunv("make", {"install", "-j4", "PYTHONAPPSDIR=" .. package:installdir()})
-- set python environments
local version = package:version()
local envs = {PYTHONPATH = package:installdir("lib", "python" .. version:major() .. "." .. version:minor(), "site-packages")}
package:addenv("PYTHONPATH", envs.PYTHONPATH)
-- install resources
local resources =
{
@ -85,10 +90,16 @@ package("python2")
assert(resource.sha256 == hash.sha256(resourcefile), "resource(%s): unmatched checksum!", name)
assert(archive.extract(resourcefile, resourcedir), "resource(%s): extract failed!", name)
local setupfile = assert(find_file("setup.py", path.join(resourcedir, "*")), "resource(%s): setup.py not found!", name)
os.vrunv("python", {setupfile, "install"})
local oldir = os.cd(path.directory(setupfile))
os.vrunv("python2", {"setup.py", "install", "--prefix=" .. package:installdir()}, {envs = envs})
os.cd(oldir)
end
end)
on_test(function (package)
os.vrun("python2 --version")
os.vrun("python2 -c \"import ssl\"")
os.vrun("python2 -c \"import pip\"")
os.vrun("python2 -c \"import setuptools\"")
os.vrun("python2 -c \"import wheel\"")
end)

Loading…
Cancel
Save