diff --git a/koch.nim b/koch.nim index 126e27aba5..3ada1314bf 100644 --- a/koch.nim +++ b/koch.nim @@ -159,7 +159,7 @@ proc bundleNimbleExe(latest: bool, args: string) = let commit = if latest: "HEAD" else: NimbleStableCommit cloneDependency(distDir, "https://github.com/nim-lang/nimble.git", commit = commit, allowBundled = true) - updateSubmodules(distDir / "nimble") + updateSubmodules(distDir / "nimble", allowBundled = true) nimCompile("dist/nimble/src/nimble.nim", options = "-d:release --noNimblePath " & args) diff --git a/tools/deps.nim b/tools/deps.nim index cc50cedb53..e9ee2a534e 100644 --- a/tools/deps.nim +++ b/tools/deps.nim @@ -43,10 +43,15 @@ proc cloneDependency*(destDirBase: string, url: string, commit = commitHead, else: quit "FAILURE: " & destdir & " already exists but is not a git repo" -proc updateSubmodules*(dir: string) = - let oldDir = getCurrentDir() - setCurrentDir(dir) - try: - exec "git submodule update --init" - finally: - setCurrentDir(oldDir) \ No newline at end of file +proc updateSubmodules*(dir: string, allowBundled = false) = + if isGitRepo(dir): + let oldDir = getCurrentDir() + setCurrentDir(dir) + try: + exec "git submodule update --init" + finally: + setCurrentDir(oldDir) + elif allowBundled: + discard "this dependency was bundled with Nim, don't do anything" + else: + quit "FAILURE: " & dir & " already exists but is not a git repo"