Fix nim v1.2

This commit is contained in:
Tanguy 2023-01-23 14:37:23 +01:00
parent 7329b0d9f8
commit 642dd2f78c
No known key found for this signature in database
GPG Key ID: 7DD8EC6B6CE6C45E
1 changed files with 3 additions and 7 deletions

View File

@ -128,7 +128,7 @@ task pin, "Create a lockfile":
exec "nim c -r tools/pinner.nim"
import sequtils
import os, json
import os
task install_pinned, "Reads the lockfile":
let toInstall = readFile(PinFile).splitWhitespace().mapIt((it.split(";", 1)[0], it.split(";", 1)[1]))
# [('packageName', 'packageFullUri')]
@ -145,17 +145,13 @@ task install_pinned, "Reads the lockfile":
for dependency in listDirs(nimblePkgs):
let
fileName = dependency.extractFilename
jsonContent = parseJson(readFile(dependency & "/nimblemeta.json"))
fileContent =
if "metaData" in jsonContent: jsonContent["metaData"]
else: jsonContent
fileContent = readFile(dependency & "/nimblemeta.json")
packageName = fileName.split('-')[0]
version = fileContent.getOrDefault("vcsRevision").getStr("")
if toInstall.anyIt(
it[0] == packageName and
(
it[1].split('#')[^1] == version or # nimble for nim 2.X
it[1].split('#')[^1] in fileContent or # nimble for nim 2.X
fileName.endsWith(it[1].split('#')[^1]) # nimble for nim 1.X
)
) == false or