From 75ece74bdd29d0a1495da05c9d30e367b62efb2b Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Tue, 1 Nov 2022 19:53:14 +0800 Subject: [PATCH] fixes #20526; use `nimPreviewSlimSystem` for documentation build (#20714) * fixes #20526; use `nimPreviewSlimSystem` for `koch docs` * fixes documentation errors * fixes remaning issues --- koch.nim | 2 +- lib/impure/rdstdin.nim | 3 +++ lib/nimhcr.nim | 3 +++ lib/packages/docutils/highlite.nim | 2 +- lib/posix/inotify.nim | 3 +++ lib/posix/posix_utils.nim | 3 +++ lib/pure/asyncfile.nim | 2 +- lib/pure/asyncftpclient.nim | 5 +++++ lib/pure/coro.nim | 3 +++ lib/pure/nimprof.nim | 3 +++ lib/pure/parsexml.nim | 2 +- lib/pure/reservedmem.nim | 3 +++ lib/pure/smtp.nim | 3 +++ lib/std/private/globs.nim | 2 +- lib/wrappers/openssl.nim | 2 ++ nimsuggest/sexp.nim | 3 +++ 16 files changed, 39 insertions(+), 5 deletions(-) diff --git a/koch.nim b/koch.nim index 5828115a25..5348f4ca4e 100644 --- a/koch.nim +++ b/koch.nim @@ -676,7 +676,7 @@ when isMainModule: case normalize(op.key) of "boot": boot(op.cmdLineRest) of "clean": clean(op.cmdLineRest) - of "doc", "docs": buildDocs(op.cmdLineRest & paCode, localDocsOnly, localDocsOut) + of "doc", "docs": buildDocs(op.cmdLineRest & " --d:nimPreviewSlimSystem " & paCode, localDocsOnly, localDocsOut) of "doc0", "docs0": # undocumented command for Araq-the-merciful: buildDocs(op.cmdLineRest & gaCode) diff --git a/lib/impure/rdstdin.nim b/lib/impure/rdstdin.nim index f23657fa98..935c83671f 100644 --- a/lib/impure/rdstdin.nim +++ b/lib/impure/rdstdin.nim @@ -26,6 +26,9 @@ when defined(nimPreviewSlimSystem): import std/syncio when defined(windows): + when defined(nimPreviewSlimSystem): + import std/syncio + proc readLineFromStdin*(prompt: string): string {. tags: [ReadIOEffect, WriteIOEffect].} = ## Reads a line from stdin. diff --git a/lib/nimhcr.nim b/lib/nimhcr.nim index b35ecf8df8..8bccfc22e5 100644 --- a/lib/nimhcr.nim +++ b/lib/nimhcr.nim @@ -200,6 +200,9 @@ batchable: false # block. Perhaps something can be done about this - some way of re-allocating # the state and transferring the old... +when defined(nimPreviewSlimSystem): + import std/assertions + when not defined(js) and (defined(hotcodereloading) or defined(createNimHcr) or defined(testNimHcr)): diff --git a/lib/packages/docutils/highlite.nim b/lib/packages/docutils/highlite.nim index 5d34ac4c8a..3f65c8cc4b 100644 --- a/lib/packages/docutils/highlite.nim +++ b/lib/packages/docutils/highlite.nim @@ -61,7 +61,7 @@ import from algorithm import binarySearch when defined(nimPreviewSlimSystem): - import std/assertions + import std/[assertions, syncio] type diff --git a/lib/posix/inotify.nim b/lib/posix/inotify.nim index 7c3cb46c54..109d3680e1 100644 --- a/lib/posix/inotify.nim +++ b/lib/posix/inotify.nim @@ -7,6 +7,9 @@ # distribution, for details about the copyright. # +when defined(nimPreviewSlimSystem): + import std/syncio + # Get the platform-dependent flags. # Structure describing an inotify event. type diff --git a/lib/posix/posix_utils.nim b/lib/posix/posix_utils.nim index a9a6413f40..0bd83b27b6 100644 --- a/lib/posix/posix_utils.nim +++ b/lib/posix/posix_utils.nim @@ -14,6 +14,9 @@ import posix, parsecfg, os import std/private/since +when defined(nimPreviewSlimSystem): + import std/syncio + type Uname* = object sysname*, nodename*, release*, version*, machine*: string diff --git a/lib/pure/asyncfile.nim b/lib/pure/asyncfile.nim index 0a748a5fba..88fa904061 100644 --- a/lib/pure/asyncfile.nim +++ b/lib/pure/asyncfile.nim @@ -27,7 +27,7 @@ import asyncdispatch, os when defined(nimPreviewSlimSystem): import std/[assertions, syncio] - when defined(windows): + when defined(windows) or defined(nimdoc): import std/widestrs # TODO: Fix duplication introduced by PR #4683. diff --git a/lib/pure/asyncftpclient.nim b/lib/pure/asyncftpclient.nim index 6cae657214..c242b388b6 100644 --- a/lib/pure/asyncftpclient.nim +++ b/lib/pure/asyncftpclient.nim @@ -84,6 +84,11 @@ import asyncdispatch, asyncnet, nativesockets, strutils, parseutils, os, times from net import BufferSize, SslContext + +when defined(nimPreviewSlimSystem): + import std/syncio + + when defined(ssl): from net import SslHandshakeType, newContext, SslCVerifyMode var defaultSslContext {.threadvar.}: SslContext diff --git a/lib/pure/coro.nim b/lib/pure/coro.nim index aaf442a83e..47dfdd7917 100644 --- a/lib/pure/coro.nim +++ b/lib/pure/coro.nim @@ -33,6 +33,9 @@ import os import lists include system/timers +when defined(nimPreviewSlimSystem): + import std/assertions + const defaultStackSize = 512 * 1024 const useOrcArc = defined(gcArc) or defined(gcOrc) diff --git a/lib/pure/nimprof.nim b/lib/pure/nimprof.nim index 6ee9de0a48..fe497c6450 100644 --- a/lib/pure/nimprof.nim +++ b/lib/pure/nimprof.nim @@ -23,6 +23,9 @@ when defined(nimHasUsed): import hashes, algorithm, strutils, tables, sets +when defined(nimPreviewSlimSystem): + import std/syncio + when not defined(memProfiler): include "system/timers" diff --git a/lib/pure/parsexml.nim b/lib/pure/parsexml.nim index 3ba5a19d5b..884f258f38 100644 --- a/lib/pure/parsexml.nim +++ b/lib/pure/parsexml.nim @@ -150,7 +150,7 @@ import strutils, lexbase, streams, unicode when defined(nimPreviewSlimSystem): - import std/assertions + import std/[assertions, syncio] # the parser treats ``
`` as ``

`` diff --git a/lib/pure/reservedmem.nim b/lib/pure/reservedmem.nim index d115392148..bf14fc5749 100644 --- a/lib/pure/reservedmem.nim +++ b/lib/pure/reservedmem.nim @@ -20,6 +20,9 @@ from std/oserrors import raiseOSError, osLastError +when defined(nimPreviewSlimSystem): + import std/assertions + template distance*(lhs, rhs: pointer): int = cast[int](rhs) - cast[int](lhs) diff --git a/lib/pure/smtp.nim b/lib/pure/smtp.nim index f5196ce1e9..70c869a06c 100644 --- a/lib/pure/smtp.nim +++ b/lib/pure/smtp.nim @@ -46,6 +46,9 @@ import net, strutils, strtabs, base64, os, strutils import asyncnet, asyncdispatch +when defined(nimPreviewSlimSystem): + import std/assertions + export Port type diff --git a/lib/std/private/globs.nim b/lib/std/private/globs.nim index 28a8103727..5e3e33cb4c 100644 --- a/lib/std/private/globs.nim +++ b/lib/std/private/globs.nim @@ -9,7 +9,7 @@ when defined(windows): from strutils import replace when defined(nimPreviewSlimSystem): - import std/assertions + import std/[assertions, objectdollar] when defined(nimHasEffectsOf): diff --git a/lib/wrappers/openssl.nim b/lib/wrappers/openssl.nim index 9a4cb41211..35b7f29a8c 100644 --- a/lib/wrappers/openssl.nim +++ b/lib/wrappers/openssl.nim @@ -884,6 +884,8 @@ when not defined(nimDisableCertificateValidation) and not defined(windows): {.pop.} when isMainModule: + when defined(nimPreviewSlimSystem): + import std/assertions # A simple certificate test let certbytes = readFile("certificate.der") let cert = d2i_X509(certbytes) diff --git a/nimsuggest/sexp.nim b/nimsuggest/sexp.nim index 5e5393b0a9..03369ccb74 100644 --- a/nimsuggest/sexp.nim +++ b/nimsuggest/sexp.nim @@ -14,6 +14,9 @@ import import std/private/decode_helpers +when defined(nimPreviewSlimSystem): + import std/[assertions, formatfloat] + type SexpEventKind* = enum ## enumeration of all events that may occur when parsing sexpError, ## an error occurred during parsing