Use marshal pre 1.2.0
This commit is contained in:
parent
f207911d38
commit
9b2aa7d4b1
2 changed files with 31 additions and 11 deletions
|
|
@ -1,4 +1,9 @@
|
|||
import json, os, strformat, strutils, tables
|
||||
import os, strformat, strutils, tables
|
||||
|
||||
when (NimMajor, NimMinor, NimPatch) < (1, 2, 0):
|
||||
import marshal
|
||||
else:
|
||||
import json
|
||||
|
||||
type
|
||||
ConanPackage* = ref object
|
||||
|
|
@ -272,6 +277,9 @@ proc loadConanInfo*(outdir: string): ConanPackage =
|
|||
file = outdir / conanInfo
|
||||
|
||||
if fileExists(file):
|
||||
when (NimMajor, NimMinor, NimPatch) < (1, 2, 0):
|
||||
result = to[ConanPackage](readFile(file))
|
||||
else:
|
||||
try:
|
||||
result = to(readFile(file).parseJson(), ConanPackage)
|
||||
except:
|
||||
|
|
@ -283,6 +291,9 @@ proc saveConanInfo*(pkg: ConanPackage, outdir: string) =
|
|||
let
|
||||
file = outdir / conanInfo
|
||||
|
||||
when (NimMajor, NimMinor, NimPatch) < (1, 2, 0):
|
||||
writeFile(file, $$pkg)
|
||||
else:
|
||||
writeFile(file, $(%pkg))
|
||||
|
||||
proc parseConanManifest(pkg: ConanPackage, outdir: string) =
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import json, os, strutils
|
||||
|
||||
when (NimMajor, NimMinor, NimPatch) < (1, 2, 0):
|
||||
import marshal
|
||||
|
||||
type
|
||||
JBBPackage* = ref object
|
||||
## JBBPackage type that stores package information
|
||||
|
|
@ -143,6 +146,9 @@ proc loadJBBInfo*(outdir: string): JBBPackage =
|
|||
file = outdir / jbbInfo
|
||||
|
||||
if fileExists(file):
|
||||
when (NimMajor, NimMinor, NimPatch) < (1, 2, 0):
|
||||
result = to[JBBPackage](readFile(file))
|
||||
else:
|
||||
try:
|
||||
result = to(readFile(file).parseJson(), JBBPackage)
|
||||
except:
|
||||
|
|
@ -154,6 +160,9 @@ proc saveJBBInfo*(pkg: JBBPackage, outdir: string) =
|
|||
let
|
||||
file = outdir / jbbInfo
|
||||
|
||||
when (NimMajor, NimMinor, NimPatch) < (1, 2, 0):
|
||||
writeFile(file, $$pkg)
|
||||
else:
|
||||
writeFile(file, $(%pkg))
|
||||
|
||||
proc dlJBBRequires*(pkg: JBBPackage, outdir: string)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue