From 93c79d79a4ba9febfd231a28632f7a6b8b46e84b Mon Sep 17 00:00:00 2001 From: ruki Date: Mon, 28 Jan 2019 22:42:04 +0800 Subject: fix load system package --- xmake/core/package/package.lua | 2 +- xmake/core/sandbox/modules/import/core/sandbox/module.lua | 3 +-- xmake/modules/package/manager/conan/install_package.lua | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 30aa9f698..f9b935cd6 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -820,7 +820,7 @@ function package.load_from_system(packagename) end -- make sandbox instance with the given script - local instance, errors = sandbox.new(on_install, interp:filter(), interp:rootdir()) + local instance, errors = sandbox.new(on_install, interp:filter()) if not instance then return nil, errors end diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua index 35a6e5df8..96c115ac8 100644 --- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua +++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua @@ -392,10 +392,9 @@ function core_sandbox_module.import(name, opt) -- the root directory for this sandbox script local rootdir = opt.rootdir or instance:rootdir() - assert(rootdir) -- init module directories (disable local packages?) - local modules_directories = opt.nolocal and core_sandbox_module.directories() or table.join(rootdir, core_sandbox_module.directories()) + local modules_directories = (opt.nolocal or not rootdir) and core_sandbox_module.directories() or table.join(rootdir, core_sandbox_module.directories()) -- load module local found, module, errors = core_sandbox_module._find_and_load(name, opt, instance, modules, modules_directories) diff --git a/xmake/modules/package/manager/conan/install_package.lua b/xmake/modules/package/manager/conan/install_package.lua index 114dd6202..5e609e7d0 100644 --- a/xmake/modules/package/manager/conan/install_package.lua +++ b/xmake/modules/package/manager/conan/install_package.lua @@ -76,6 +76,12 @@ function main(name, opt) -- get build directory local buildir = _get_build_directory(name) + -- clean the build directory + os.tryrm(buildir) + if not os.isdir(buildir) then + os.mkdir(buildir) + end + -- enter build directory local oldir = os.cd(buildir) -- cgit v1.3.1