Skip to content

Commit a9bbabe

Browse files
committed
Add a powershell stub for janet-pm virtual envs.
1 parent ecb8918 commit a9bbabe

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

spork/cc.janet

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@
437437

438438
(defn- msvc-opt
439439
[to]
440-
(def pdb-name (string to ".pdb"))
441440
(case (build-type)
442-
:debug ["/Od" "/Zi" "/MDd" (string "/Fd" pdb-name)]
441+
:debug ["/Od" "/DDEBUG" "/Zi" "/MDd" (string "/Fd" to ".pdb")]
442+
:develop ["/O2" "/DDEBUG" "/Zi" "/MDd" (string "/Fd" to ".pdb")]
443443
["/O2" "/MD"]))
444444
(defn- msvc-defines []
445445
(def res @[])

spork/pm.janet

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,28 @@
665665
hash -r 2> /dev/null;
666666
````)
667667

668+
(deftemplate enter-ps-template
669+
````
670+
# . bin/activate.ps1
671+
$$global:_OLD_JANET_PATH=$$env:JANET_PATH
672+
$$global:_OLD_PATH=$$env:PATH
673+
$$env:JANET_PATH="$abspath"
674+
$$env:PATH=$$JANET_PATH + "/bin:" + $$env:PATH
675+
$$old_prompt = Get-Content function:prompt
676+
function global:prompt {
677+
Write-Host "($name) " -NoNewline
678+
& $$old_prompt
679+
}
680+
function deactivate {
681+
$$env:PATH=$$global:_OLD_PATH
682+
$$env:JANET_PATH=$$global:_OLD_JANET_PATH
683+
Remove-Item function:\deactivate
684+
function global:prompt {
685+
& $$old_prompt
686+
}
687+
}
688+
````)
689+
668690
(deftemplate enter-cmd-template
669691
````
670692
@rem bin\activate.bat
@@ -695,6 +717,7 @@
695717
(os/mkdir (path/join path "man"))
696718
(def opts {:path path :abspath (path/abspath path) :name (path/basename path)})
697719
(spit (path/join path "bin" "activate") (enter-shell-template opts))
720+
(spit (path/join path "bin" "activate.ps1") (enter-ps-template opts))
698721
(spit (path/join path "bin" "activate.bat") (enter-cmd-template opts))
699722
(spit (path/join path "bin" "deactivate.bat") (exit-cmd-template opts))
700723
(print "created project shell environment at " path)

0 commit comments

Comments
 (0)