install resources for python

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

@ -9,7 +9,7 @@ package("meson")
add_versions("0.50.1", "f68f56d60c80a77df8fc08fa1016bc5831605d4717b622c96212573271e14ecc")
add_deps("ninja", "python 3.x")
on_install("@macosx", "@linux", function (package)
local version = package:dep("python"):version()
local envs = {PYTHONPATH = package:installdir("lib", "python" .. version:major() .. "." .. version:minor(), "site-packages")}

@ -30,7 +30,8 @@ package("python")
end
end
else
set_urls("https://www.python.org/ftp/python/$(version)/Python-$(version).tgz")
set_urls("https://www.python.org/ftp/python/$(version)/Python-$(version).tgz",
"https://github.com/xmake-mirror/cpython/releases/download/v$(version)/Python-$(version).tgz")
add_versions("2.7.15", "18617d1f15a380a919d517630a9cd85ce17ea602f9bbdc58ddc672df4b0239db")
add_versions("3.7.0", "85bb9feb6863e04fb1700b018d9d42d1caac178559ffa453d7e6a436e259fd0d")
end
@ -74,7 +75,7 @@ package("python")
-- allow python modules to use ctypes.find_library to find xmake's stuff
if is_host("macosx") then
io.gsub("Lib/ctypes/macholib/dyld.py", "DEFAULT_LIBRARY_FALLBACK = [", format("DEFAULT_LIBRARY_FALLBACK = [ '%s/lib',", package:installdir()))
io.gsub("Lib/ctypes/macholib/dyld.py", "DEFAULT_LIBRARY_FALLBACK = %[", format("DEFAULT_LIBRARY_FALLBACK = [ '%s/lib',", package:installdir()))
end
-- unset these so that installing pip and setuptools puts them where we want
@ -103,15 +104,15 @@ package("python")
}
import("net.http")
import("utils.archive")
import("lib.detect.find_file")
for name, resource in pairs(resources) do
local resourcefile = path.join(package:cachedir(), path.filename(resource.url))
local resourcefile = path.join(os.curdir(), path.filename(resource.url))
local resourcedir = resourcefile .. ".dir"
http.download(resource.url, resourcefile)
assert(resource.sha256 == hash.sha256(resourcefile), "resource(%s): unmatched checksum!", name)
assert(archive.extract(resourcefile, resourcedir), "resource(%s): extract failed!", name)
os.cd(resourcedir)
os.vrun("python setup.py install")
os.cd("-")
local setupfile = assert(find_file("setup.py", path.join(resourcedir, "*")), "resource(%s): setup.py not found!", name)
os.vrunv("python", {setupfile, "install"})
end
end)

@ -13,7 +13,8 @@ package("python2")
add_versions("2.7.15", "f34e2555c4fde5d7d746e6a0bbfc9151435f3f5c3eaddfc046ec0993b7cc9660")
end
else
set_urls("https://www.python.org/ftp/python/$(version)/Python-$(version).tgz")
set_urls("https://www.python.org/ftp/python/$(version)/Python-$(version).tgz",
"https://github.com/xmake-mirror/cpython/releases/download/v$(version)/Python-$(version).tgz")
add_versions("2.7.15", "18617d1f15a380a919d517630a9cd85ce17ea602f9bbdc58ddc672df4b0239db")
end
@ -47,7 +48,7 @@ package("python2")
-- allow python modules to use ctypes.find_library to find xmake's stuff
if is_host("macosx") then
io.gsub("Lib/ctypes/macholib/dyld.py", "DEFAULT_LIBRARY_FALLBACK = [", format("DEFAULT_LIBRARY_FALLBACK = [ '%s/lib',", package:installdir()))
io.gsub("Lib/ctypes/macholib/dyld.py", "DEFAULT_LIBRARY_FALLBACK = %[", format("DEFAULT_LIBRARY_FALLBACK = [ '%s/lib',", package:installdir()))
end
-- unset these so that installing pip and setuptools puts them where we want
@ -76,15 +77,15 @@ package("python2")
}
import("net.http")
import("utils.archive")
import("lib.detect.find_file")
for name, resource in pairs(resources) do
local resourcefile = path.join(package:cachedir(), path.filename(resource.url))
local resourcefile = path.join(os.curdir(), path.filename(resource.url))
local resourcedir = resourcefile .. ".dir"
http.download(resource.url, resourcefile)
assert(resource.sha256 == hash.sha256(resourcefile), "resource(%s): unmatched checksum!", name)
assert(archive.extract(resourcefile, resourcedir), "resource(%s): extract failed!", name)
os.cd(resourcedir)
os.vrun("python2 setup.py install")
os.cd("-")
local setupfile = assert(find_file("setup.py", path.join(resourcedir, "*")), "resource(%s): setup.py not found!", name)
os.vrunv("python", {setupfile, "install"})
end
end)

Loading…
Cancel
Save