1
0
mirror of https://github.com/janet-lang/janet synced 2024-09-27 14:48:13 +00:00

Allow relative paths for jpm commands (deps)

Also default headerpath, libpath, and binpath of
of (dyn :syspath) instead of $JANET_MODPATH. This
allows setting $JANET_MODPATH without needing to
mess with the other settings.
This commit is contained in:
Calvin Rose 2019-09-01 11:08:39 -05:00
parent 141d3e9588
commit 530d94a4b9

View File

@ -95,13 +95,13 @@
(def JANET_MODPATH (or (os/getenv "JANET_MODPATH") (dyn :syspath))) (def JANET_MODPATH (or (os/getenv "JANET_MODPATH") (dyn :syspath)))
(def JANET_HEADERPATH (or (os/getenv "JANET_HEADERPATH") (def JANET_HEADERPATH (or (os/getenv "JANET_HEADERPATH")
(if-let [j JANET_MODPATH] (if-let [j (dyn :syspath)]
(string j "/../../include/janet")))) (string j "/../../include/janet"))))
(def JANET_BINPATH (or (os/getenv "JANET_BINPATH") (def JANET_BINPATH (or (os/getenv "JANET_BINPATH")
(if-let [j JANET_MODPATH] (if-let [j (dyn :syspath)]
(string j "/../../bin")))) (string j "/../../bin"))))
(def JANET_LIBPATH (or (os/getenv "JANET_LIBPATH") (def JANET_LIBPATH (or (os/getenv "JANET_LIBPATH")
(if-let [j JANET_MODPATH] (if-let [j (dyn :syspath)]
(string j "/..")))) (string j "/.."))))
# #
@ -512,7 +512,9 @@ int main(int argc, const char **argv) {
"Create an absolute path. Does not resolve . and .. (useful for "Create an absolute path. Does not resolve . and .. (useful for
generating entries in install manifest file)." generating entries in install manifest file)."
[path] [path]
(if (string/has-prefix? absprefix) (if (if is-win
(peg/match '(+ "\\" (* (range "AZ" "az") ":\\")) path)
(string/has-prefix? "/" path))
path path
(string (os/cwd) sep path))) (string (os/cwd) sep path)))
@ -581,9 +583,13 @@ int main(int argc, const char **argv) {
(set fresh true) (set fresh true)
(os/execute ["git" "clone" repo module-dir] :p)) (os/execute ["git" "clone" repo module-dir] :p))
(def olddir (os/cwd)) (def olddir (os/cwd))
(os/cd module-dir)
(try (try
(with-dyns [:rules @{}] (with-dyns [:rules @{}
:modpath (abspath (dyn :modpath JANET_MODPATH))
:headerpath (abspath (dyn :headerpath JANET_HEADERPATH))
:libpath (abspath (dyn :libpath JANET_LIBPATH))
:binpath (abspath (dyn :binpath JANET_BINPATH))]
(os/cd module-dir)
(unless fresh (unless fresh
(os/execute ["git" "pull" "origin" "master"] :p)) (os/execute ["git" "pull" "origin" "master"] :p))
(when tag (when tag