Sitelet https://github.com/lua-stdlib/lua-stdlib/commit/aadbbad064a34b2fdf859a171b089eba3a666ea1
Skip to content

Commit aadbbad

Browse files
committed
configury: simplify file generation.
* lib/std.lua.in (version): Move from here... * local.mk (lib/std/version.lua): ...to here. * lib/std.lua.in: Rename from here... * lib/std/init.lua: ...to here. (version): Remove declaration. Now autovivified from std.version. * local.mk (dist_lua_DATA): Remove. (EXTRA_DIST): Remove lib/std.lua.in. * build-aux/config.ld.in (file): Rename from ../lib/std.lua to ../lib/std/init.lua. * specs/std_spec.yaml (before): Undo cached autovivified version. (require): Reset _VERSION carefully. * specs/string_spec.yaml (require_version): Likewise. * .gitignore: Add lib/std/version.lua, remove lib/std.lua. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
1 parent 3cc3e37 commit aadbbad

6 files changed

Lines changed: 15 additions & 19 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/config.status
2020
/configure
2121
/doc
22-
/lib/std.lua
22+
/lib/std/version.lua
2323
/luarocks
2424
/m4/ax_lua.m4
2525
/m4/slingshot.m4

‎build-aux/config.ld.in‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dir = "."
4242

4343
file = {
4444
-- Core Functions
45-
"../lib/std.lua",
45+
"../lib/std/init.lua",
4646

4747
-- Core Libraries
4848
"../lib/std/debug.lua",

lib/std.lua.in renamed to lib/std/init.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ end
154154
M = {
155155
--- Release version string.
156156
-- @field version
157-
version = "General Lua libraries / @VERSION@",
158157

159158

160159
--- Core Functions

‎local.mk‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ include specs/specs.mk
6161
## Build. ##
6262
## ------ ##
6363

64-
dist_lua_DATA += \
65-
lib/std.lua \
66-
$(NOTHING_ELSE)
67-
6864
luastddir = $(luadir)/std
6965

7066
dist_luastd_DATA = \
@@ -73,6 +69,7 @@ dist_luastd_DATA = \
7369
lib/std/debug.lua \
7470
lib/std/functional.lua \
7571
lib/std/io.lua \
72+
lib/std/init.lua \
7673
lib/std/list.lua \
7774
lib/std/math.lua \
7875
lib/std/maturity.lua \
@@ -87,6 +84,7 @@ dist_luastd_DATA = \
8784
lib/std/table.lua \
8885
lib/std/tree.lua \
8986
lib/std/tuple.lua \
87+
lib/std/version.lua \
9088
$(NOTHING_ELSE)
9189

9290
luastddeletedir = $(luastddir)/delete-after
@@ -110,12 +108,11 @@ dist_luastddebug_DATA = \
110108
lib/std/debug_init/init.lua \
111109
$(NOTHING_ELSE)
112110

113-
# In order to avoid regenerating std.lua at configure time, which
114-
# causes the documentation to be rebuilt and hence requires users to
115-
# have ldoc installed, put std/std.lua in as a Makefile dependency.
116-
# (Strictly speaking, distributing an AC_CONFIG_FILE would be wrong.)
117-
lib/std.lua: lib/std.lua.in
118-
./config.status --file=$@
111+
lib/std/version.lua:
112+
echo 'return "General Lua libraries / $(VERSION)"' > $@T
113+
@test -f $@ || cp -f $@T $@
114+
@cmp -s $@T $@ || cp -f $@T $@
115+
@rm -f $@T
119116

120117

121118
## Use a builtin rockspec build with root at $(srcdir)/lib, and note
@@ -129,7 +126,6 @@ mkrockspecs_args = --module-dir $(srcdir)/lib --repository lua-stdlib
129126

130127
EXTRA_DIST += \
131128
build-aux/config.ld.in \
132-
lib/std.lua.in \
133129
$(NOTHING_ELSE)
134130

135131

‎specs/std_spec.yaml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ before: |
55
exported_apis = { "assert", "barrel", "elems", "eval", "getmetamethod",
66
"ielems", "ipairs", "ireverse", "monkey_patch",
77
"npairs", "pairs", "require", "ripairs", "rnpairs",
8-
"tostring", "version" }
8+
"tostring" }
99
1010
-- Tables with iterator metamethods used by various examples.
1111
__pairs = setmetatable ({ content = "a string" }, {
@@ -27,6 +27,7 @@ before: |
2727
})
2828
2929
M = require (this_module)
30+
M.version = nil -- previous specs may have autoloaded it
3031
3132
3233
specify std:
@@ -455,9 +456,9 @@ specify std:
455456
expect (f "std").to_be (require "std")
456457
- it uses _VERSION when version field is nil:
457458
std = require "std"
458-
M._VERSION, M.version = M.version, M._VERSION
459+
M._VERSION, M.version = M.version, nil
459460
expect (f ("std", "41", "9999")).to_be (require "std")
460-
M._VERSION, M.version = M.version, M._VERSION
461+
M._VERSION, M.version = nil, M._VERSION
461462
- context with semantic versioning:
462463
- before:
463464
std = require "std"

‎specs/string_spec.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,9 @@ specify std.string:
570570
expect (f "std").to_be (require "std")
571571
- it uses _VERSION when version field is nil:
572572
std = require "std"
573-
std._VERSION, std.version = std.version, std._VERSION
573+
std._VERSION, std.version = std.version, nil
574574
expect (f ("std", "41", "9999")).to_be (require "std")
575-
std._VERSION, std.version = std.version, std._VERSION
575+
std._VERSION, std.version = nil, std._VERSION
576576
- context with semantic versioning:
577577
- before:
578578
std = require "std"

0 commit comments

Comments
 (0)