Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 7cc4c23

Browse files
committed
Compiler: Use a virtualenv to install dependencies
1 parent 9e41bf5 commit 7cc4c23

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Compiler/package.nim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const pipModules = ["pyinstaller", "virtualenv", "disnake", "requests", "pyarmor
1313

1414
proc packageInstaller*() =
1515
printName()
16+
var appDirectory = getAppDir()
17+
setCurrentDir(appDirectory)
18+
1619
stdout.styledWriteLine({styleBright}, " >> Dependencies Installer <<")
1720
echo ""
1821

@@ -34,6 +37,23 @@ proc packageInstaller*() =
3437
stdout.styledWriteLine(fgGreen, {styleBright}, "- Python installed!")
3538
echo ""
3639

40+
# Otherwise, create a virtual env (and check if it exists)
41+
if not dirExists("NR_VENV"):
42+
discard execShellCmd("python -m venv NR_VENV")
43+
44+
let
45+
oldPath = getEnv("PATH")
46+
envPath = absolutePath("NR_VENV")
47+
scriptsPath = envPath / "Scripts"
48+
49+
if oldPath.isSome:
50+
setEnv("PATH", scriptsPath & PathSep & oldPath.get())
51+
else:
52+
setEnv("PATH", scriptsPath)
53+
setEnv("VIRTUAL_ENV", envPath)
54+
55+
discard execShellCmd("pip freeze") # DEBUG
56+
3757
stdout.styledWriteLine({styleBright}, "[2] Checking if packages already installed...")
3858
var result = execCmdEx("dism")
3959

0 commit comments

Comments
 (0)