renames to leveldbstatic

This commit is contained in:
ThatBen 2024-05-13 14:08:17 +02:00
parent db0239b2ec
commit 2d399e3247
10 changed files with 22 additions and 31 deletions

View File

@ -3,7 +3,7 @@ root=$(dirname "$0")
sourceDir="${root}/vendor" sourceDir="${root}/vendor"
buildDir="${root}/build" buildDir="${root}/build"
output="${root}/leveldb/raw.nim" output="${root}/leveldbstatic/raw.nim"
# install nimterop, if not already installed # install nimterop, if not already installed
if ! [ -x "$(command -v toast)" ]; then if ! [ -x "$(command -v toast)" ]; then
@ -50,17 +50,7 @@ toast \
--includeDirs="${buildDir}/include" \ --includeDirs="${buildDir}/include" \
"${sourceDir}/include/leveldb/c.h" >> "${output}" "${sourceDir}/include/leveldb/c.h" >> "${output}"
# {.compile: "./vendor
# {.compile: root & "/vendor
# {.passC: "-I./vendor".}
# {.passC: "-I./build/include".}
# {.passC: "-I" & root/"vendor
sed -i 's/\bpassC\b/passc/g' "${output}" sed -i 's/\bpassC\b/passc/g' "${output}"
sed -i 's/{\.compile\:\ \"\./{\.compile\:\ root\ \&\ \"/g' "${output}" sed -i 's/{\.compile\:\ \"\./{\.compile\:\ root\ \&\ \"/g' "${output}"
sed -i 's/{\.passc\:\ \"-I\./{\.passc\:\ \"-I\"\ \&\ root\ \&\ \"/g' "${output}" sed -i 's/{\.passc\:\ \"-I\./{\.passc\:\ \"-I\"\ \&\ root\ \&\ \"/g' "${output}"

View File

@ -1,12 +0,0 @@
# Package
version = "0.4.1"
author = "Michał Zieliński"
description = "LevelDB wrapper for Nim"
license = "MIT"
bin = @["leveldbtool"]
installDirs = @["build", "leveldb", "vendor"]
installFiles = @["leveldb.nim"]
# Dependencies
requires "nim >= 1.4.0"

View File

@ -9,7 +9,7 @@
## Create a database: ## Create a database:
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## import leveldb ## import leveldbstatic
## import options ## import options
## ##
## var db = leveldb.open("/tmp/mydata") ## var db = leveldb.open("/tmp/mydata")
@ -52,7 +52,7 @@
## db.close() ## db.close()
import options, os, strutils import options, os, strutils
import leveldb/raw import leveldbstatic/raw
type type
LevelDb* = ref object LevelDb* = ref object
@ -78,7 +78,7 @@ type
const const
version* = block: version* = block:
const configFile = "leveldb.nimble" const configFile = "leveldbstatic.nimble"
const sourcePath = currentSourcePath() const sourcePath = currentSourcePath()
const parentConfig = sourcePath.parentDir.parentDir / configFile const parentConfig = sourcePath.parentDir.parentDir / configFile
const localConfig = sourcePath.parentDir / configFile const localConfig = sourcePath.parentDir / configFile

12
leveldbstatic.nimble Normal file
View File

@ -0,0 +1,12 @@
# Package
version = "0.1.0"
author = "leveldbstatic authors"
description = "Statically linked LevelDB wrapper for Nim"
license = "MIT"
bin = @["leveldbtool"]
installDirs = @["build", "leveldbstatic", "vendor"]
installFiles = @["leveldbstatic.nim"]
# Dependencies
requires "nim >= 1.4.0"

View File

@ -1,5 +1,5 @@
import options, os, strutils import options, os, strutils
import leveldb import leveldbstatic as leveldb
proc tool() = proc tool() =
proc usage() = proc usage() =

View File

@ -12,4 +12,4 @@ bin = @["packagetest"]
# Dependencies # Dependencies
requires "nim >= 0.18.0" requires "nim >= 0.18.0"
requires "leveldb" requires "leveldbstatic"

View File

@ -1,6 +1,6 @@
import os import os
import options import options
import leveldb import leveldbstatic as leveldb
when isMainModule: when isMainModule:
let tempDir = getTempDir() / "testleveldb" / "tooldb" let tempDir = getTempDir() / "testleveldb" / "tooldb"

View File

@ -1,5 +1,6 @@
import unittest, options, os, osproc, sequtils, strutils import unittest, options, os, osproc, sequtils, strutils
import leveldb, leveldb/raw import leveldbstatic as leveldb
import leveldbstatic/raw
const const
tmpDir = getTempDir() / "testleveldb" tmpDir = getTempDir() / "testleveldb"
@ -212,7 +213,7 @@ suite "package":
test "import as package": test "import as package":
let (output, exitCode) = execNimble("install") let (output, exitCode) = execNimble("install")
check exitCode == QuitSuccess check exitCode == QuitSuccess
check output.contains("leveldb installed successfully.") check output.contains("leveldbstatic installed successfully.")
cd "tests"/"packagetest": cd "tests"/"packagetest":
var (output, exitCode) = execNimble("build") var (output, exitCode) = execNimble("build")