diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2018-09-07 01:06:12 +0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-09-07 02:42:15 +0300 |
| commit | 5b0d8ff87f53c368861a8913df1861c3940df1ea (patch) | |
| tree | 327f294a50188d2a7d13303628e753ccec5e0c54 | |
| parent | b8abb27f98e3c674bd3bca4944a53d10a1a2025d (diff) | |
| download | luarocks-5b0d8ff87f53c368861a8913df1861c3940df1ea.tar.gz luarocks-5b0d8ff87f53c368861a8913df1861c3940df1ea.tar.bz2 luarocks-5b0d8ff87f53c368861a8913df1861c3940df1ea.zip | |
builtin: improve skiplist for module autodetection
Skips spec/ files even when there is no src/
| -rw-r--r-- | src/luarocks/build/builtin.lua | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 2db6f256..3d1e974d 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
| @@ -68,9 +68,12 @@ do | |||
| 68 | return (data:match("int%s+luaopen_([a-zA-Z0-9_]+)")) | 68 | return (data:match("int%s+luaopen_([a-zA-Z0-9_]+)")) |
| 69 | end | 69 | end |
| 70 | 70 | ||
| 71 | local luamod_blacklist = { | 71 | local skiplist = { |
| 72 | test = true, | 72 | ["spec"] = true, |
| 73 | tests = true, | 73 | [".luarocks"] = true, |
| 74 | ["lua_modules"] = true, | ||
| 75 | ["test.lua"] = true, | ||
| 76 | ["tests.lua"] = true, | ||
| 74 | } | 77 | } |
| 75 | 78 | ||
| 76 | function builtin.autodetect_modules(libs, incdirs, libdirs) | 79 | function builtin.autodetect_modules(libs, incdirs, libdirs) |
| @@ -88,21 +91,22 @@ do | |||
| 88 | end | 91 | end |
| 89 | 92 | ||
| 90 | for _, file in ipairs(fs.find()) do | 93 | for _, file in ipairs(fs.find()) do |
| 91 | local luamod = file:match("(.*)%.lua$") | 94 | local base = file:match("^([^\\/]*)") |
| 92 | if file:match("^.luarocks") or file:match("^lua_modules") then | 95 | if not skiplist[base] then |
| 93 | -- skip | 96 | local luamod = file:match("(.*)%.lua$") |
| 94 | elseif luamod and not luamod_blacklist[luamod] then | 97 | if luamod then |
| 95 | modules[path.path_to_module(file)] = prefix..file | 98 | modules[path.path_to_module(file)] = prefix..file |
| 96 | else | 99 | else |
| 97 | local cmod = file:match("(.*)%.c$") | 100 | local cmod = file:match("(.*)%.c$") |
| 98 | if cmod then | 101 | if cmod then |
| 99 | local modname = get_cmod_name(file) or path.path_to_module(file:gsub("%.c$", ".lua")) | 102 | local modname = get_cmod_name(file) or path.path_to_module(file:gsub("%.c$", ".lua")) |
| 100 | modules[modname] = { | 103 | modules[modname] = { |
| 101 | sources = prefix..file, | 104 | sources = prefix..file, |
| 102 | libraries = libs, | 105 | libraries = libs, |
| 103 | incdirs = incdirs, | 106 | incdirs = incdirs, |
| 104 | libdirs = libdirs, | 107 | libdirs = libdirs, |
| 105 | } | 108 | } |
| 109 | end | ||
| 106 | end | 110 | end |
| 107 | end | 111 | end |
| 108 | end | 112 | end |
