From 3e154e7740a1481a6bfaaf658f183be81d64aa41 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Wed, 21 Apr 2021 07:41:33 +0200 Subject: [PATCH] CIs: attempt to use csources_v1 (#16282) * CIs: attempt to use csources_v1 * also updated the BSDs * also updated azure pipelines * std modules should not itself use the 'std/' import dir... * compiler has to be careful with std/ for v1 booting (cherry picked from commit a9b62de8956af50424767408bbe30631c63b331b) --- .builds/freebsd.yml | 2 +- .builds/openbsd_0.yml | 2 +- .builds/openbsd_1.yml | 2 +- .github/workflows/ci_docs.yml | 4 ++-- azure-pipelines.yml | 2 +- ci/build.bat | 2 +- ci/build.sh | 2 +- ci/nsis_build.bat | 2 +- compiler/jsgen.nim | 2 +- compiler/nim.nim | 2 +- compiler/nimpaths.nim | 2 +- compiler/vmgen.nim | 2 +- lib/pure/os.nim | 2 ++ lib/pure/sugar.nim | 2 +- lib/pure/typetraits.nim | 2 +- lib/std/jsonutils.nim | 18 +++++++++--------- lib/std/monotimes.nim | 2 +- lib/std/private/globs.nim | 2 +- lib/std/sha1.nim | 4 ++-- lib/std/wrapnils.nim | 2 +- 20 files changed, 31 insertions(+), 29 deletions(-) diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index 6898a80fdc..443be798a9 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -15,7 +15,7 @@ environment: tasks: - setup: | cd Nim - git clone --depth 1 -q https://github.com/nim-lang/csources.git + git clone --depth 1 -q https://github.com/nim-lang/csources_v1.git csources gmake -C csources -j $(sysctl -n hw.ncpu) bin/nim c --skipUserCfg --skipParentCfg koch echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv diff --git a/.builds/openbsd_0.yml b/.builds/openbsd_0.yml index 278cb3de9d..e0f7579d11 100644 --- a/.builds/openbsd_0.yml +++ b/.builds/openbsd_0.yml @@ -18,7 +18,7 @@ environment: tasks: - setup: | cd Nim - git clone --depth 1 -q https://github.com/nim-lang/csources.git + git clone --depth 1 -q https://github.com/nim-lang/csources_v1.git csources gmake -C csources -j $(sysctl -n hw.ncpuonline) bin/nim c koch echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv diff --git a/.builds/openbsd_1.yml b/.builds/openbsd_1.yml index d3f0c8795d..3a316bf23e 100644 --- a/.builds/openbsd_1.yml +++ b/.builds/openbsd_1.yml @@ -18,7 +18,7 @@ environment: tasks: - setup: | cd Nim - git clone --depth 1 -q https://github.com/nim-lang/csources.git + git clone --depth 1 -q https://github.com/nim-lang/csources_v1.git csources gmake -C csources -j $(sysctl -n hw.ncpuonline) bin/nim c koch echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 74ca804f32..f726f7f3b3 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -74,7 +74,7 @@ jobs: id: csources-version shell: bash run: | - sha=$(git ls-remote https://github.com/nim-lang/csources master | cut -f 1) + sha=$(git ls-remote https://github.com/nim-lang/csources_v1 master | cut -f 1) echo "::set-output name=sha::$sha" - name: 'Get prebuilt csources from cache' @@ -88,7 +88,7 @@ jobs: if: steps.csources-cache.outputs.cache-hit != 'true' uses: actions/checkout@v2 with: - repository: nim-lang/csources + repository: nim-lang/csources_v1 path: csources - name: 'Build 1-stage compiler from csources' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 109efc6e12..e42dfcd980 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -55,7 +55,7 @@ jobs: - checkout: self fetchDepth: 1 - - bash: git clone --depth 1 https://github.com/nim-lang/csources + - bash: git clone --depth 1 https://github.com/nim-lang/csources_v1 csources displayName: 'Checkout Nim csources' - task: NodeTool@0 diff --git a/ci/build.bat b/ci/build.bat index cdce8d3d29..2227168e56 100644 --- a/ci/build.bat +++ b/ci/build.bat @@ -2,7 +2,7 @@ REM Some debug info echo "Running on %CI_RUNNER_ID% (%CI_RUNNER_DESCRIPTION%) with tags %CI_RUNNER_TAGS%." gcc -v -git clone --depth 1 https://github.com/nim-lang/csources.git +git clone --depth 1 https://github.com/nim-lang/csources_v1.git csources cd csources call build64.bat cd .. diff --git a/ci/build.sh b/ci/build.sh index 6321fffba8..a89d011edc 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -1,7 +1,7 @@ sh ci/deps.sh # Build from C sources. -git clone --depth 1 https://github.com/nim-lang/csources.git +git clone --depth 1 https://github.com/nim-lang/csources_v1.git csources cd csources sh build.sh cd .. diff --git a/ci/nsis_build.bat b/ci/nsis_build.bat index 4806810d7f..12aff1b724 100644 --- a/ci/nsis_build.bat +++ b/ci/nsis_build.bat @@ -25,7 +25,7 @@ Rem Build csources koch csources -d:release || exit /b rem Grab C sources and nimsuggest -git clone --depth 1 https://github.com/nim-lang/csources.git +git clone --depth 1 https://github.com/nim-lang/csources_v1.git csources set PATH=%CD%\bin;%PATH% diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 37b35821c0..ae7deeac9e 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -35,7 +35,7 @@ import cgmeth, lowerings, sighashes, modulegraphs, lineinfos, rodutils, transf, injectdestructors, sourcemap -import std/[json, sets, math, tables, intsets, strutils] +import json, sets, math, tables, intsets, strutils from modulegraphs import ModuleGraph, PPassContext diff --git a/compiler/nim.nim b/compiler/nim.nim index 15aeccb33d..5a73590fab 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -24,7 +24,7 @@ import idents, lineinfos, cmdlinehelper, pathutils, modulegraphs -from std/browsers import openDefaultBrowser +from browsers import openDefaultBrowser from nodejs import findNodeJs when hasTinyCBackend: diff --git a/compiler/nimpaths.nim b/compiler/nimpaths.nim index 7b2216080b..b53a81b860 100644 --- a/compiler/nimpaths.nim +++ b/compiler/nimpaths.nim @@ -16,7 +16,7 @@ interpolation variables: Unstable API ]## -import std/[os,strutils] +import os, strutils const docCss* = "$nimr/doc/nimdoc.css" diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index d5b5b58b43..4a593c655c 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -16,7 +16,7 @@ # types that use the 'node' field; the reason is that slots are # re-used in a register based VM. Example: # -#..code-block:: nim +#.. code-block:: nim # let s = a & b # no matter what, create fresh node # s = a & b # no matter what, keep the node # diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 234d82bc2e..544ee5df6b 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -965,6 +965,8 @@ proc expandTilde*(path: string): string {. ## Windows: this is still supported despite Windows platform not having this ## convention; also, both ``~/`` and ``~\`` are handled. ## + ## **Warning**: `~bob` and `~bob/` are not yet handled correctly. + ## ## See also: ## * `getHomeDir proc <#getHomeDir>`_ ## * `getConfigDir proc <#getConfigDir>`_ diff --git a/lib/pure/sugar.nim b/lib/pure/sugar.nim index 15f951e240..92d7ca1c02 100644 --- a/lib/pure/sugar.nim +++ b/lib/pure/sugar.nim @@ -11,7 +11,7 @@ ## macro system. import std/private/since -import macros, typetraits +import macros proc checkPragma(ex, prag: var NimNode) = since (1, 3): diff --git a/lib/pure/typetraits.nim b/lib/pure/typetraits.nim index 9d7ba82f72..722bac1c3f 100644 --- a/lib/pure/typetraits.nim +++ b/lib/pure/typetraits.nim @@ -108,7 +108,7 @@ since (1, 3, 5): doAssert elementType(myiter(3)) is int typeof(block: (for ai in a: ai)) -import std/macros +import macros macro genericParamsImpl(T: typedesc): untyped = # auxiliary macro needed, can't do it directly in `genericParams` diff --git a/lib/std/jsonutils.nim b/lib/std/jsonutils.nim index 2b5cffebd3..dd40965719 100644 --- a/lib/std/jsonutils.nim +++ b/lib/std/jsonutils.nim @@ -13,7 +13,7 @@ runnableExamples: let j = a.toJson doAssert j.jsonTo(type(a)).toJson == j -import std/[json,strutils,tables,sets,strtabs,options] +import json, strutils, tables, sets, strtabs, options #[ Future directions: @@ -27,7 +27,7 @@ add a way to customize serialization, for e.g.: objects. ]# -import std/macros +import macros type Joptions* = object @@ -106,7 +106,7 @@ proc hasField[T](obj: T, field: string): bool = return true return false -macro accessField(obj: typed, name: static string): untyped = +macro accessField(obj: typed, name: static string): untyped = newDotExpr(obj, ident(name)) template fromJsonFields(newObj, oldObj, json, discKeys, opt) = @@ -146,7 +146,7 @@ template fromJsonFields(newObj, oldObj, json, discKeys, opt) = json.len == numMatched else: json.len == num and num == numMatched - + checkJson ok, $(json.len, num, numMatched, $T, json) proc fromJson*[T](a: var T, b: JsonNode, opt = Joptions()) @@ -278,7 +278,7 @@ proc toJson*[T](a: T): JsonNode = proc fromJsonHook*[K, V](t: var (Table[K, V] | OrderedTable[K, V]), jsonNode: JsonNode) = ## Enables `fromJson` for `Table` and `OrderedTable` types. - ## + ## ## See also: ## * `toJsonHook proc<#toJsonHook,(Table[K,V]|OrderedTable[K,V])>`_ runnableExamples: @@ -314,7 +314,7 @@ proc toJsonHook*[K, V](t: (Table[K, V] | OrderedTable[K, V])): JsonNode = proc fromJsonHook*[A](s: var SomeSet[A], jsonNode: JsonNode) = ## Enables `fromJson` for `HashSet` and `OrderedSet` types. - ## + ## ## See also: ## * `toJsonHook proc<#toJsonHook,SomeSet[A]>`_ runnableExamples: @@ -348,7 +348,7 @@ proc toJsonHook*[A](s: SomeSet[A]): JsonNode = proc fromJsonHook*[T](self: var Option[T], jsonNode: JsonNode) = ## Enables `fromJson` for `Option` types. - ## + ## ## See also: ## * `toJsonHook proc<#toJsonHook,Option[T]>`_ runnableExamples: @@ -383,7 +383,7 @@ proc toJsonHook*[T](self: Option[T]): JsonNode = proc fromJsonHook*(a: var StringTableRef, b: JsonNode) = ## Enables `fromJson` for `StringTableRef` type. - ## + ## ## See also: ## * `toJsonHook` proc<#toJsonHook,StringTableRef>`_ runnableExamples: @@ -401,7 +401,7 @@ proc fromJsonHook*(a: var StringTableRef, b: JsonNode) = proc toJsonHook*(a: StringTableRef): JsonNode = ## Enables `toJson` for `StringTableRef` type. - ## + ## ## See also: ## * `fromJsonHook` proc<#fromJsonHook,StringTableRef,JsonNode>`_ runnableExamples: diff --git a/lib/std/monotimes.nim b/lib/std/monotimes.nim index c56bf77b30..f84670ecc4 100644 --- a/lib/std/monotimes.nim +++ b/lib/std/monotimes.nim @@ -74,7 +74,7 @@ when defined(js): system.`+`(a, b) {.pop.} -elif defined(posix): +elif defined(posix) and not defined(osx): import posix elif defined(windows): diff --git a/lib/std/private/globs.nim b/lib/std/private/globs.nim index e697ca91cf..622eb71d52 100644 --- a/lib/std/private/globs.nim +++ b/lib/std/private/globs.nim @@ -4,7 +4,7 @@ this can eventually be moved to std/os and `walkDirRec` can be implemented in te to avoid duplication ]## -import std/[os,strutils] +import os, strutils type PathEntry* = object diff --git a/lib/std/sha1.nim b/lib/std/sha1.nim index 958ac8ab01..5724ddb4ae 100644 --- a/lib/std/sha1.nim +++ b/lib/std/sha1.nim @@ -33,8 +33,8 @@ runnableExamples: ## * `hashes module`_ for efficient computations of hash values for diverse Nim types ## * `md5 module`_ implements the MD5 checksum algorithm -import std/strutils -from std/endians import bigEndian32, bigEndian64 +import strutils +from endians import bigEndian32, bigEndian64 const Sha1DigestSize = 20 diff --git a/lib/std/wrapnils.nim b/lib/std/wrapnils.nim index 71205c887e..24bdba5c1d 100644 --- a/lib/std/wrapnils.nim +++ b/lib/std/wrapnils.nim @@ -82,7 +82,7 @@ template `[]`*(a: Wrapnil): untyped = else: default(T) -import std/macros +import macros proc replace(n: NimNode): NimNode = if n.kind == nnkPar: