From b1a56279ffc1870760520f19b6f4f9e17971fbc5 Mon Sep 17 00:00:00 2001 From: Ganesh Viswanathan Date: Thu, 9 Jan 2020 17:50:09 -0600 Subject: [PATCH] Fix CI, drop 0.19.6 support --- .travis.yml | 2 -- appveyor.yml | 1 - nimterop/all.nim | 2 +- nimterop/ast2.nim | 4 ++-- nimterop/build.nim | 8 +++----- nimterop/cimport.nim | 2 +- nimterop/docs.nim | 30 +++++++++++++----------------- nimterop/getters.nim | 10 +++++----- nimterop/toast.nim | 2 +- nimterop/types.nim | 27 ++++----------------------- 10 files changed, 30 insertions(+), 58 deletions(-) diff --git a/.travis.yml b/.travis.yml index 86e5fbc..359d07b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,14 +10,12 @@ addons: language: c env: - - BRANCH=0.19.6 - BRANCH=0.20.2 - BRANCH=1.0.4 - BRANCH=devel cache: directories: - - "$HOME/.choosenim/toolchains/nim-0.19.6" - "$HOME/.choosenim/toolchains/nim-0.20.2" - "$HOME/.choosenim/toolchains/nim-1.0.4" diff --git a/appveyor.yml b/appveyor.yml index 7678cf1..5651948 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,6 @@ matrix: environment: matrix: - - NIM_VERSION: 0.19.6 - NIM_VERSION: 0.20.2 - NIM_VERSION: 1.0.4 diff --git a/nimterop/all.nim b/nimterop/all.nim index c024d01..dc22967 100644 --- a/nimterop/all.nim +++ b/nimterop/all.nim @@ -4,4 +4,4 @@ Module that should import everything so that `nim doc --project nimtero/all` run # TODO: make sure it does import everything. -import "."/[cimport, build, types, plugin, compat] +import "."/[cimport, build, types, plugin] diff --git a/nimterop/ast2.nim b/nimterop/ast2.nim index 6c62b05..810beea 100644 --- a/nimterop/ast2.nim +++ b/nimterop/ast2.nim @@ -4,7 +4,7 @@ import compiler/[ast, astalgo, idents, options, renderer] import "."/treesitter/api -import "."/[compat, globals, getters] +import "."/[globals, getters] proc addConst(nimState: NimState, node: TSNode) = # #define X Y @@ -137,7 +137,7 @@ proc newArrayTree(nimState: NimState, node: TSNode, typ, size: PNode): PNode = proc getTypeArray(nimState: NimState, node: TSNode): PNode proc getTypeProc(nimState: NimState, name: string, node: TSNode): PNode -proc newIdentDefs(nimState: NimState, name: string, node: TSNode, offset: uint64, exported = false): PNode = +proc newIdentDefs(nimState: NimState, name: string, node: TSNode, offset: SomeInteger, exported = false): PNode = # Create nkIdentDefs tree for specified proc parameter or object field # # For proc, param should not be exported diff --git a/nimterop/build.nim b/nimterop/build.nim index 6ac21e9..3eec406 100644 --- a/nimterop/build.nim +++ b/nimterop/build.nim @@ -2,8 +2,6 @@ import hashes, macros, osproc, sets, strformat, strutils, tables import os except findExe, sleep -import "."/[compat] - proc sanitizePath*(path: string, noQuote = false, sep = $DirSep): string = result = path.multiReplace([("\\\\", sep), ("\\", sep), ("/", sep)]) if not noQuote: @@ -648,7 +646,7 @@ proc getGccPaths*(mode = "c"): seq[string] = break if inc: var - path = line.strip().myNormalizedPath() + path = line.strip().normalizedPath() if path notin result: result.add path @@ -667,13 +665,13 @@ proc getGccLibPaths*(mode = "c"): seq[string] = if "LIBRARY_PATH=" in line: for path in line[13 .. ^1].split(PathSep): var - path = path.strip().myNormalizedPath() + path = path.strip().normalizedPath() if path notin result: result.add path break elif '\t' in line: var - path = line.strip().myNormalizedPath() + path = line.strip().normalizedPath() if path notin result: result.add path diff --git a/nimterop/cimport.nim b/nimterop/cimport.nim index 4c63c31..84f7b4f 100644 --- a/nimterop/cimport.nim +++ b/nimterop/cimport.nim @@ -21,7 +21,7 @@ const CIMPORT {.used.} = 1 include "."/globals -import "."/[build, compat, paths, types] +import "."/[build, paths, types] export types proc interpPath(dir: string): string= diff --git a/nimterop/docs.nim b/nimterop/docs.nim index 17089ec..7ea797a 100644 --- a/nimterop/docs.nim +++ b/nimterop/docs.nim @@ -1,22 +1,18 @@ import macros, strformat -when (NimMajor, NimMinor, NimPatch) >= (0, 19, 9): - from os import parentDir, getCurrentCompilerExe, DirSep - proc getNimRootDir(): string = - #[ - hack, but works - alternatively (but more complex), use (from a nim file, not nims otherwise - you get Error: ambiguous call; both system.fileExists): - import "$nim/testament/lib/stdtest/specialpaths.nim" - nimRootDir - ]# - fmt"{currentSourcePath}".parentDir.parentDir.parentDir -else: - proc getCurrentCompilerExe*(): string = - "nim" +from os import parentDir, getCurrentCompilerExe, DirSep +proc getNimRootDir(): string = + #[ + hack, but works + alternatively (but more complex), use (from a nim file, not nims otherwise + you get Error: ambiguous call; both system.fileExists): + import "$nim/testament/lib/stdtest/specialpaths.nim" + nimRootDir + ]# + fmt"{currentSourcePath}".parentDir.parentDir.parentDir - const - DirSep = when defined(windows): '\\' else: '/' +const + DirSep = when defined(windows): '\\' else: '/' proc execAction(cmd: string): string = var @@ -80,4 +76,4 @@ proc buildDocs*(files: openArray[string], path: string, baseDir = getProjectPath for i in 0 .. paramCount(): if paramStr(i) == "--publish": echo execAction(&"cd {path} && ghp-import --no-jekyll -fp {path}") - break \ No newline at end of file + break diff --git a/nimterop/getters.nim b/nimterop/getters.nim index 84d7d83..2469d1c 100644 --- a/nimterop/getters.nim +++ b/nimterop/getters.nim @@ -4,7 +4,7 @@ import regex import compiler/[ast, idents, lineinfos, msgs, pathutils, renderer] -import "."/[build, compat, globals, plugin, treesitter/api] +import "."/[build, globals, plugin, treesitter/api] const gReserved = """ addr and as asm @@ -236,11 +236,11 @@ proc getLit*(str: string): PNode = proc isNil*(node: TSNode): bool = node.tsNodeIsNull() -proc len*(node: TSNode): uint = +proc len*(node: TSNode): int = if not node.isNil: - result = node.tsNodeNamedChildCount().uint + result = node.tsNodeNamedChildCount().int -proc `[]`*(node: TSNode, i: BiggestUInt): TSNode = +proc `[]`*(node: TSNode, i: SomeInteger): TSNode = if i < node.len(): result = node.tsNodeNamedChild(i.uint32) @@ -652,6 +652,6 @@ proc loadPlugin*(gState: State, sourcePath: string) = proc expandSymlinkAbs*(path: string): string = try: - result = path.expandSymlink().absolutePath(path.parentDir()).myNormalizedPath() + result = path.expandSymlink().absolutePath(path.parentDir()).normalizedPath() except: result = path diff --git a/nimterop/toast.nim b/nimterop/toast.nim index 26f9cdc..f775738 100644 --- a/nimterop/toast.nim +++ b/nimterop/toast.nim @@ -2,7 +2,7 @@ import os, osproc, strformat, strutils, times import "."/treesitter/[api, c, cpp] -import "."/[ast2, compat, globals, getters] +import "."/[ast2, globals, getters] proc process(gState: State, path: string) = doAssert existsFile(path), &"Invalid path {path}" diff --git a/nimterop/types.nim b/nimterop/types.nim index a57252f..89f779d 100644 --- a/nimterop/types.nim +++ b/nimterop/types.nim @@ -1,26 +1,7 @@ -# see https://github.com/nimterop/nimterop/issues/79 - -when (NimMajor, NimMinor, NimPatch) < (0, 19, 9): - # clean this up once upgraded; adapted from std/time_t - when defined(nimdoc): - type - impl = distinct int64 - Time = impl - elif defined(windows): - when defined(i386) and defined(gcc): - type Time {.importc: "time_t", header: "".} = distinct int32 - else: - type Time {.importc: "time_t", header: "".} = distinct int64 - elif defined(posix): - import posix - type - time_t* = Time - time64_t* = Time -else: - import std/time_t as time_t_temp - type - time_t* = time_t_temp.Time - time64_t* = time_t_temp.Time +import std/time_t as time_t_temp +type + time_t* = time_t_temp.Time + time64_t* = time_t_temp.Time when defined(cpp): # http://www.cplusplus.com/reference/cwchar/wchar_t/