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
This commit is contained in:
parent
7bce1f8578
commit
a9b62de895
58 changed files with 142 additions and 143 deletions
|
|
@ -7,16 +7,16 @@
|
|||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
import std/macros
|
||||
from std/typetraits import OrdinalEnum, HoleyEnum
|
||||
import macros
|
||||
from typetraits import OrdinalEnum, HoleyEnum
|
||||
|
||||
# xxx `genEnumCaseStmt` needs tests and runnableExamples
|
||||
|
||||
macro genEnumCaseStmt*(typ: typedesc, argSym: typed, default: typed,
|
||||
macro genEnumCaseStmt*(typ: typedesc, argSym: typed, default: typed,
|
||||
userMin, userMax: static[int], normalizer: static[proc(s :string): string]): untyped =
|
||||
# generates a case stmt, which assigns the correct enum field given
|
||||
# a normalized string comparison to the `argSym` input.
|
||||
# string normalization is done using passed normalizer.
|
||||
# string normalization is done using passed normalizer.
|
||||
# NOTE: for an enum with fields Foo, Bar, ... we cannot generate
|
||||
# `of "Foo".nimIdentNormalize: Foo`.
|
||||
# This will fail, if the enum is not defined at top level (e.g. in a block).
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ runnableExamples:
|
|||
let j = a.toJson
|
||||
assert j.jsonTo(typeof(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())
|
||||
|
|
@ -284,7 +284,7 @@ proc toJson*[T](a: T): JsonNode =
|
|||
proc fromJsonHook*[K: string|cstring, V](t: var (Table[K, V] | OrderedTable[K, V]),
|
||||
jsonNode: JsonNode) =
|
||||
## Enables `fromJson` for `Table` and `OrderedTable` types.
|
||||
##
|
||||
##
|
||||
## See also:
|
||||
## * `toJsonHook proc<#toJsonHook>`_
|
||||
runnableExamples:
|
||||
|
|
@ -326,7 +326,7 @@ proc toJsonHook*[K: string|cstring, V](t: (Table[K, V] | OrderedTable[K, V])): J
|
|||
|
||||
proc fromJsonHook*[A](s: var SomeSet[A], jsonNode: JsonNode) =
|
||||
## Enables `fromJson` for `HashSet` and `OrderedSet` types.
|
||||
##
|
||||
##
|
||||
## See also:
|
||||
## * `toJsonHook proc<#toJsonHook,SomeSet[A]>`_
|
||||
runnableExamples:
|
||||
|
|
@ -360,7 +360,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:
|
||||
|
|
@ -395,7 +395,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:
|
||||
|
|
@ -413,7 +413,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:
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ See also
|
|||
* `times module <times.html>`_
|
||||
]##
|
||||
|
||||
import std/times
|
||||
import times
|
||||
|
||||
type
|
||||
MonoTime* = object ## Represents a monotonic timestamp.
|
||||
|
|
@ -77,7 +77,7 @@ when defined(js):
|
|||
{.pop.}
|
||||
|
||||
elif defined(posix) and not defined(osx):
|
||||
import std/posix
|
||||
import posix
|
||||
|
||||
elif defined(windows):
|
||||
proc QueryPerformanceCounter(res: var uint64) {.
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
import os
|
||||
when defined(windows):
|
||||
from strutils import replace
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
## * `std/packedsets <packedsets.html>`_
|
||||
## * `std/sets <sets.html>`_
|
||||
|
||||
import std/[typetraits, macros]
|
||||
import typetraits, macros
|
||||
|
||||
#[
|
||||
type SetElement* = char|byte|bool|int16|uint16|enum|uint8|int8
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ runnableExamples("-r:off"):
|
|||
b = parseSecureHash("10DFAEBF6BFDBC7939957068E2EFACEC4972933C")
|
||||
assert a == b, "files don't match"
|
||||
|
||||
import std/strutils
|
||||
from std/endians import bigEndian32, bigEndian64
|
||||
import strutils
|
||||
from endians import bigEndian32, bigEndian64
|
||||
|
||||
const Sha1DigestSize = 20
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
## .. warning:: This module was added in Nim 1.6. If you are using it for cryptographic purposes,
|
||||
## keep in mind that so far this has not been audited by any security professionals,
|
||||
## therefore may not be secure.
|
||||
##
|
||||
##
|
||||
## `std/sysrand` generates random numbers from a secure source provided by the operating system.
|
||||
## It is a cryptographically secure pseudorandom number generator
|
||||
## and should be unpredictable enough for cryptographic applications,
|
||||
|
|
@ -52,10 +52,10 @@ runnableExamples:
|
|||
|
||||
|
||||
when not defined(js):
|
||||
import std/os
|
||||
import os
|
||||
|
||||
when defined(posix):
|
||||
import std/posix
|
||||
import posix
|
||||
|
||||
const
|
||||
batchImplOS = defined(freebsd) or defined(openbsd) or (defined(macosx) and not defined(ios))
|
||||
|
|
@ -243,7 +243,7 @@ elif defined(macosx):
|
|||
"""
|
||||
|
||||
proc getentropy(p: pointer, size: csize_t): cint {.importc: "getentropy", header: sysrandomHeader.}
|
||||
# getentropy() fills a buffer with random data, which can be used as input
|
||||
# getentropy() fills a buffer with random data, which can be used as input
|
||||
# for process-context pseudorandom generators like arc4random(3).
|
||||
# The maximum buffer size permitted is 256 bytes.
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ proc urandom*(dest: var openArray[byte]): bool =
|
|||
|
||||
proc urandom*(size: Natural): seq[byte] {.inline.} =
|
||||
## Returns random bytes suitable for cryptographic use.
|
||||
##
|
||||
##
|
||||
## .. warning:: The code hasn't been audited by cryptography experts and
|
||||
## is provided as-is without guarantees. Use at your own risks. For production
|
||||
## systems we advise you to request an external audit.
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ runnableExamples:
|
|||
|
||||
assert (?.f2.x2.x2).x3 == nil # this terminates ?. early
|
||||
|
||||
from std/options import Option, isSome, get, option, unsafeGet, UnpackDefect
|
||||
from options import Option, isSome, get, option, unsafeGet, UnpackDefect
|
||||
export options.get, options.isSome, options.isNone
|
||||
|
||||
template fakeDot*(a: Option, b): untyped =
|
||||
|
|
@ -59,7 +59,7 @@ func `[]`*[U](a: Option[U]): auto {.inline.} =
|
|||
if a2 != nil:
|
||||
result = option(a2[])
|
||||
|
||||
import std/macros
|
||||
import macros
|
||||
|
||||
func replace(n: NimNode): NimNode =
|
||||
if n.kind == nnkDotExpr:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue