Replace deprecated procs (#560)
* Replace deprecated procs * Remove deprecated proc * Use sugar instead of future * Use sugar instead of future 2 * Remove renameBabelToNimble since it wasn't exported or used anyways * Use sugar instead of future 3 * Use toUnix
This commit is contained in:
parent
f7373e03d5
commit
66d79bf9a0
6 changed files with 7 additions and 19 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
import system except TResult
|
import system except TResult
|
||||||
|
|
||||||
import httpclient, parseopt, os, osproc, pegs, tables, parseutils,
|
import httpclient, parseopt, os, osproc, pegs, tables, parseutils,
|
||||||
strtabs, json, algorithm, sets, uri, future, sequtils
|
strtabs, json, algorithm, sets, uri, sugar, sequtils
|
||||||
|
|
||||||
import strutils except toLower
|
import strutils except toLower
|
||||||
from unicode import toLower
|
from unicode import toLower
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ proc setupVM(graph: ModuleGraph; module: PSym; scriptName: string, flags: Flags)
|
||||||
cbos copyFile:
|
cbos copyFile:
|
||||||
os.copyFile(getString(a, 0), getString(a, 1))
|
os.copyFile(getString(a, 0), getString(a, 1))
|
||||||
cbos getLastModificationTime:
|
cbos getLastModificationTime:
|
||||||
setResult(a, toSeconds(getLastModificationTime(getString(a, 0))))
|
setResult(a, toUnix(getLastModificationTime(getString(a, 0))))
|
||||||
|
|
||||||
cbos rawExec:
|
cbos rawExec:
|
||||||
setResult(a, osproc.execCmd getString(a, 0))
|
setResult(a, osproc.execCmd getString(a, 0))
|
||||||
|
|
@ -713,4 +713,4 @@ proc listTasks*(scriptName: string, options: Options) =
|
||||||
discard execScript(scriptName, nil, options)
|
discard execScript(scriptName, nil, options)
|
||||||
# TODO (#402): Make the 'task' template generate explicit data structure
|
# TODO (#402): Make the 'task' template generate explicit data structure
|
||||||
# containing all the task names + descriptions.
|
# containing all the task names + descriptions.
|
||||||
cleanup()
|
cleanup()
|
||||||
|
|
|
||||||
|
|
@ -212,18 +212,6 @@ proc promptList*(options: Options, question: string, args: openarray[string]): s
|
||||||
## options is selected.
|
## options is selected.
|
||||||
return promptList(options.forcePrompts, question, args)
|
return promptList(options.forcePrompts, question, args)
|
||||||
|
|
||||||
proc renameBabelToNimble(options: Options) {.deprecated.} =
|
|
||||||
let babelDir = getHomeDir() / ".babel"
|
|
||||||
let nimbleDir = getHomeDir() / ".nimble"
|
|
||||||
if dirExists(babelDir):
|
|
||||||
if options.prompt("Found deprecated babel package directory, would you " &
|
|
||||||
"like to rename it to nimble?"):
|
|
||||||
copyDir(babelDir, nimbleDir)
|
|
||||||
copyFile(babelDir / "babeldata.json", nimbleDir / "nimbledata.json")
|
|
||||||
|
|
||||||
removeDir(babelDir)
|
|
||||||
removeFile(nimbleDir / "babeldata.json")
|
|
||||||
|
|
||||||
proc getNimbleDir*(options: Options): string =
|
proc getNimbleDir*(options: Options): string =
|
||||||
result = options.config.nimbleDir
|
result = options.config.nimbleDir
|
||||||
if options.nimbleDir.len != 0:
|
if options.nimbleDir.len != 0:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (C) Dominik Picheta. All rights reserved.
|
# Copyright (C) Dominik Picheta. All rights reserved.
|
||||||
# BSD License. Look at license.txt for more info.
|
# BSD License. Look at license.txt for more info.
|
||||||
import parsecfg, json, streams, strutils, parseutils, os, tables, future
|
import parsecfg, json, streams, strutils, parseutils, os, tables, sugar
|
||||||
from sequtils import apply, map
|
from sequtils import apply, map
|
||||||
|
|
||||||
import version, tools, common, nimscriptsupport, options, packageinfo, cli
|
import version, tools, common, nimscriptsupport, options, packageinfo, cli
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ proc getGithubAuth(o: Options): Auth =
|
||||||
proc isCorrectFork(j: JsonNode): bool =
|
proc isCorrectFork(j: JsonNode): bool =
|
||||||
# Check whether this is a fork of the nimble packages repo.
|
# Check whether this is a fork of the nimble packages repo.
|
||||||
result = false
|
result = false
|
||||||
if j{"fork"}.getBVal():
|
if j{"fork"}.getBool():
|
||||||
result = j{"parent"}{"full_name"}.getStr() == "nim-lang/packages"
|
result = j{"parent"}{"full_name"}.getStr() == "nim-lang/packages"
|
||||||
|
|
||||||
proc forkExists(a: Auth): bool =
|
proc forkExists(a: Auth): bool =
|
||||||
|
|
@ -217,7 +217,7 @@ proc publish*(p: PackageInfo, o: Options) =
|
||||||
|
|
||||||
cd pkgsDir:
|
cd pkgsDir:
|
||||||
editJson(p, url, tags, downloadMethod)
|
editJson(p, url, tags, downloadMethod)
|
||||||
let branchName = "add-" & p.name & getTime().getGMTime().format("HHmm")
|
let branchName = "add-" & p.name & getTime().utc.format("HHmm")
|
||||||
doCmd("git checkout -B " & branchName)
|
doCmd("git checkout -B " & branchName)
|
||||||
doCmd("git commit packages.json -m \"Added package " & p.name & "\"")
|
doCmd("git commit packages.json -m \"Added package " & p.name & "\"")
|
||||||
display("Pushing", "to remote of fork.", priority = HighPriority)
|
display("Pushing", "to remote of fork.", priority = HighPriority)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (C) Dominik Picheta. All rights reserved.
|
# Copyright (C) Dominik Picheta. All rights reserved.
|
||||||
# BSD License. Look at license.txt for more info.
|
# BSD License. Look at license.txt for more info.
|
||||||
import osproc, streams, unittest, strutils, os, sequtils, future
|
import osproc, streams, unittest, strutils, os, sequtils, sugar
|
||||||
|
|
||||||
# TODO: Each test should start off with a clean slate. Currently installed
|
# TODO: Each test should start off with a clean slate. Currently installed
|
||||||
# packages are shared between each test which causes a multitude of issues
|
# packages are shared between each test which causes a multitude of issues
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue