Skip to content

Commit

Permalink
refactor os imports into corresponding small modules (#20720)
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout authored Nov 1, 2022
1 parent d735c44 commit 6166b79
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion compiler/vmops.nim
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ when declared(math.signbit):


from std/envvars import getEnv, existsEnv, delEnv, putEnv, envPairs
from std/os import walkDir, getAppFilename
from std/os import getAppFilename
from std/private/oscommon import dirExists, fileExists
from std/private/osdirs import walkDir

from std/times import cpuTime
from std/hashes import hash
Expand Down
2 changes: 1 addition & 1 deletion lib/pure/distros.nim
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ from std/strutils import contains, toLowerAscii

when not defined(nimscript):
from std/osproc import execProcess
from std/os import existsEnv
from std/envvars import existsEnv

type
Distribution* {.pure.} = enum ## the list of known distributions
Expand Down
3 changes: 2 additions & 1 deletion lib/pure/memfiles.nim
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ elif defined(posix):
else:
{.error: "the memfiles module is not supported on your operating system!".}

import os, streams
import streams
import std/oserrors

when defined(nimPreviewSlimSystem):
import std/[syncio, assertions]
Expand Down
2 changes: 1 addition & 1 deletion lib/pure/reservedmem.nim
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
##
## Unstable API.

from os import raiseOSError, osLastError
from std/oserrors import raiseOSError, osLastError

template distance*(lhs, rhs: pointer): int =
cast[int](rhs) - cast[int](lhs)
Expand Down
3 changes: 2 additions & 1 deletion lib/pure/selectors.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
##
## TODO: `/dev/poll`, `event ports` and filesystem events.

import os, nativesockets
import nativesockets
import std/oserrors

when defined(nimPreviewSlimSystem):
import std/assertions
Expand Down
2 changes: 1 addition & 1 deletion lib/pure/strtabs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ when defined(js) or defined(nimscript) or defined(Standalone):
{.pragma: rtlFunc.}
else:
{.pragma: rtlFunc, rtl.}
import os
import std/envvars

include "system/inclrtl"

Expand Down
2 changes: 1 addition & 1 deletion lib/std/sysrand.nim
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ runnableExamples:


when not defined(js):
import os
import std/oserrors

when defined(posix):
import posix
Expand Down
2 changes: 1 addition & 1 deletion lib/windows/registry.nim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## This module is experimental and its interface may change.

import winlean, os
import std/oserrors

when defined(nimPreviewSlimSystem):
import std/widestrs
Expand Down

0 comments on commit 6166b79

Please sign in to comment.