diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2019-07-25 14:57:25 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-25 14:57:25 -0300 |
| commit | c79d3a85820d5b69b3a8f309d456a9feb4eeb013 (patch) | |
| tree | 735c6b45d5898e3ce08a13cbd7a42a0e3f7bea20 | |
| parent | 15494d4ebc734f3585218682ba4eed40f7cb20ef (diff) | |
| download | luarocks-c79d3a85820d5b69b3a8f309d456a9feb4eeb013.tar.gz luarocks-c79d3a85820d5b69b3a8f309d456a9feb4eeb013.tar.bz2 luarocks-c79d3a85820d5b69b3a8f309d456a9feb4eeb013.zip | |
Don't use project dir or default_lua_version with --force-config (#1054)
Fixes #1045.
| -rw-r--r-- | src/luarocks/cmd.lua | 9 | ||||
| -rw-r--r-- | src/luarocks/core/cfg.lua | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua index 08505129..4397ffbd 100644 --- a/src/luarocks/cmd.lua +++ b/src/luarocks/cmd.lua | |||
| @@ -13,6 +13,11 @@ local dir = require("luarocks.dir") | |||
| 13 | local fun = require("luarocks.fun") | 13 | local fun = require("luarocks.fun") |
| 14 | local fs = require("luarocks.fs") | 14 | local fs = require("luarocks.fs") |
| 15 | 15 | ||
| 16 | local hc_ok, hardcoded = pcall(require, "luarocks.core.hardcoded") | ||
| 17 | if not hc_ok then | ||
| 18 | hardcoded = {} | ||
| 19 | end | ||
| 20 | |||
| 16 | local program = util.this_program("luarocks") | 21 | local program = util.this_program("luarocks") |
| 17 | 22 | ||
| 18 | cmd.errorcodes = { | 23 | cmd.errorcodes = { |
| @@ -189,6 +194,10 @@ do | |||
| 189 | end | 194 | end |
| 190 | 195 | ||
| 191 | local function find_default_lua_version(flags, project_dir) | 196 | local function find_default_lua_version(flags, project_dir) |
| 197 | if hardcoded.FORCE_CONFIG then | ||
| 198 | return nil | ||
| 199 | end | ||
| 200 | |||
| 192 | local dirs = {} | 201 | local dirs = {} |
| 193 | if project_dir then | 202 | if project_dir then |
| 194 | table.insert(dirs, dir.path(project_dir, ".luarocks")) | 203 | table.insert(dirs, dir.path(project_dir, ".luarocks")) |
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index d8442962..8c11d408 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
| @@ -561,7 +561,7 @@ function cfg.init(detected, warning) | |||
| 561 | local lua_incdir = detected.lua_incdir or hardcoded.LUA_INCDIR | 561 | local lua_incdir = detected.lua_incdir or hardcoded.LUA_INCDIR |
| 562 | local lua_libdir = detected.lua_libdir or hardcoded.LUA_LIBDIR | 562 | local lua_libdir = detected.lua_libdir or hardcoded.LUA_LIBDIR |
| 563 | local lua_dir = detected.lua_dir or hardcoded.LUA_DIR or (lua_bindir and lua_bindir:gsub("[\\/]bin$", "")) | 563 | local lua_dir = detected.lua_dir or hardcoded.LUA_DIR or (lua_bindir and lua_bindir:gsub("[\\/]bin$", "")) |
| 564 | local project_dir = detected.project_dir | 564 | local project_dir = (not hardcoded.FORCE_CONFIG) and detected.project_dir |
| 565 | 565 | ||
| 566 | local init = cfg.init | 566 | local init = cfg.init |
| 567 | 567 | ||
| @@ -695,7 +695,7 @@ function cfg.init(detected, warning) | |||
| 695 | ---------------------------------------- | 695 | ---------------------------------------- |
| 696 | 696 | ||
| 697 | -- Settings detected or given via the CLI (i.e. --lua-dir) take precedence over config files: | 697 | -- Settings detected or given via the CLI (i.e. --lua-dir) take precedence over config files: |
| 698 | cfg.project_dir = detected.project_dir | 698 | cfg.project_dir = project_dir |
| 699 | cfg.lua_version = detected.lua_version or cfg.lua_version | 699 | cfg.lua_version = detected.lua_version or cfg.lua_version |
| 700 | cfg.luajit_version = detected.luajit_version or cfg.luajit_version | 700 | cfg.luajit_version = detected.luajit_version or cfg.luajit_version |
| 701 | cfg.lua_interpreter = detected.lua_interpreter or cfg.lua_interpreter | 701 | cfg.lua_interpreter = detected.lua_interpreter or cfg.lua_interpreter |
