2026-05-14 12:23:10 +04:00
|
|
|
mode = ScriptMode.Verbose
|
|
|
|
|
|
|
|
|
|
packageName = "libplum"
|
2026-07-08 17:03:47 +04:00
|
|
|
version = "0.6.0"
|
2026-05-14 12:23:10 +04:00
|
|
|
author = "Status Research & Development GmbH"
|
|
|
|
|
description = "Nim binding for libplum (PCP, NAT-PMP, UPnP-IGD port mapping)"
|
|
|
|
|
license = "Apache License 2.0 or MIT"
|
|
|
|
|
installDirs = @["libplum", "vendor"]
|
2026-07-13 12:01:29 -03:00
|
|
|
installFiles = @["libplum_units.c"]
|
2026-05-14 12:23:10 +04:00
|
|
|
|
|
|
|
|
### Dependencies
|
|
|
|
|
requires "nim >= 1.6.0",
|
|
|
|
|
"results >= 0.4.0",
|
2026-05-14 16:40:10 +04:00
|
|
|
"chronos >= 4.2.0 & < 5.0.0",
|
|
|
|
|
"unittest2"
|
2026-05-14 12:23:10 +04:00
|
|
|
|
2026-05-19 14:15:26 +04:00
|
|
|
task format, "format Nim code using nph":
|
|
|
|
|
exec "nph libplum/ tests/"
|
|
|
|
|
|
2026-05-14 12:23:10 +04:00
|
|
|
task test, "run tests":
|
2026-05-14 16:40:10 +04:00
|
|
|
exec("nimble setup")
|
2026-05-18 11:43:28 +04:00
|
|
|
exec("nim c -o:tests/test_plum tests/test_plum.nim")
|
|
|
|
|
exec("./tests/test_plum")
|
|
|
|
|
|
|
|
|
|
task testIntegration, "run miniupnpd integration tests in Docker / Podman":
|
|
|
|
|
let docker = if findExe("podman") != "": "podman" else: "docker"
|
|
|
|
|
exec(docker & " build -t " & packageName & " -f tests/Dockerfile .")
|
2026-05-18 15:16:27 +04:00
|
|
|
proc envFlag(name: string): string =
|
|
|
|
|
if getEnv(name) != "": " -e " & name & "=" & getEnv(name) else: ""
|
|
|
|
|
let flags = envFlag("TEST_VERBOSE") & envFlag("MINIUPNPD_VERBOSE") & envFlag("LIBPLUM_VERBOSE")
|
|
|
|
|
exec(docker & " run --rm --cap-add=NET_ADMIN -e TEST_MINIUPNP_PCP=1" & flags & " " & packageName)
|
|
|
|
|
exec(docker & " run --rm --cap-add=NET_ADMIN -e TEST_MINIUPNP_UPNP=1" & flags & " " & packageName)
|
|
|
|
|
exec(docker & " run --rm --cap-add=NET_ADMIN -e TEST_MINIUPNP_NATPMP=1" & flags & " " & packageName)
|