File tree Expand file tree Collapse file tree 2 files changed +74
-0
lines changed
Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ package = " carray"
2+ version = " 0.0.1-1"
3+ local versionNumber = version :gsub (" ^(.*)-.-$" , " %1" )
4+ source = {
5+ url = " https://github.com/osch/lua-carray/archive/v" .. versionNumber .. " .zip" ,
6+ dir = " lua-carray-" .. versionNumber ,
7+ }
8+ description = {
9+ summary = " Arrays for primitive numeric C data types" ,
10+ homepage = " https://github.com/osch/lua-carray" ,
11+ license = " MIT" ,
12+ detailed = [[
13+ This Lua module provides an array data type together with a C API for
14+ handling arrays of primitive numeric C data types in Lua script code and
15+ also in native C code for enhancing native Lua module interoperability.
16+ ]] ,
17+ }
18+ dependencies = {
19+ " lua >= 5.1, <= 5.4" ,
20+ }
21+ build = {
22+ type = " builtin" ,
23+ modules = {
24+ carray = {
25+ sources = {
26+ " src/main.c" ,
27+ " src/carray.c" ,
28+ " src/carray_capi_impl.c" ,
29+ " src/carray_compat.c" ,
30+ },
31+ defines = { " CARRAY_VERSION=" .. versionNumber },
32+ },
33+ }
34+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/lua
2+
3+ os.setlocale (" C" )
4+
5+ local format = string.format
6+ local lfs = require (" lfs" )
7+
8+ local version = ...
9+ assert (version :match (" ^%d+%.%d+%.%d+$" ), format (" invalid version %q" , version ))
10+
11+ for fileName in lfs .dir (" ." ) do
12+ local p1 , v , p2 = fileName :match (" ^(carray%-)(%d+%.%d+%.%d+)(%-%d+%.rockspec)$" )
13+ if p1 then
14+ local newName = p1 .. version .. p2
15+ print (format (" %-30s -> %s" , fileName , newName ))
16+ local out = {}
17+ local matched = false
18+ local inFile = io.open (fileName , " r" )
19+ for line in inFile :lines () do
20+ local l1 , l2 = line :match (" ^(%s*version%s*%=%s*\" )%d+%.%d+%.%d+(%-%d+\" %s*)$" )
21+ if l1 then
22+ assert (not matched )
23+ matched = true
24+ out [# out + 1 ] = l1 .. version .. l2
25+ else
26+ out [# out + 1 ] = line
27+ end
28+ end
29+ out [# out + 1 ] = " "
30+ inFile :close ()
31+ assert (matched )
32+ local newFile , err = io.open (newName , " w" )
33+ assert (newFile , err )
34+ newFile :write (table.concat (out , " \n " ))
35+ newFile :close ()
36+ if fileName ~= newName then
37+ os.remove (fileName )
38+ end
39+ end
40+ end
You can’t perform that action at this time.
0 commit comments