1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-24 07:20:27 +00:00

More work on fixing bunlde tools install.

This commit is contained in:
Calvin Rose 2024-05-25 13:23:11 -05:00
parent 2260a593bd
commit 8334504f4e
3 changed files with 7 additions and 3 deletions

View File

@ -4067,6 +4067,7 @@
(def manifest (bundle/manifest bundle-name)) (def manifest (bundle/manifest bundle-name))
(def dir (os/cwd)) (def dir (os/cwd))
(def workdir (get manifest :local-source ".")) (def workdir (get manifest :local-source "."))
(def fixed-syspath (os/realpath (dyn *syspath*)))
(try (try
(os/cd workdir) (os/cd workdir)
([_] (print "cannot enter source directory " workdir " for bundle " bundle-name))) ([_] (print "cannot enter source directory " workdir " for bundle " bundle-name)))
@ -4077,8 +4078,9 @@
(put new-env *module-make-env* (fn make-bundle-env [&] (make-env new-env))) (put new-env *module-make-env* (fn make-bundle-env [&] (make-env new-env)))
(put new-env :workdir workdir) (put new-env :workdir workdir)
(put new-env :bundle-name bundle-name) (put new-env :bundle-name bundle-name)
(put new-env :bundle-dir (bundle-dir bundle-name)) (put new-env *syspath* fixed-syspath)
(with-env new-env (with-env new-env
(put new-env :bundle-dir (bundle-dir bundle-name)) # get the syspath right
(require (string "@syspath/bundle/" bundle-name))))) (require (string "@syspath/bundle/" bundle-name)))))
(defn- do-hook (defn- do-hook

View File

@ -958,6 +958,9 @@ const char *janet_strerror(int e) {
#ifdef JANET_WINDOWS #ifdef JANET_WINDOWS
/* Microsoft strerror seems sane here and is thread safe by default */ /* Microsoft strerror seems sane here and is thread safe by default */
return strerror(e); return strerror(e);
#elif defined(_GNU_SOURCE)
/* See https://linux.die.net/man/3/strerror_r */
return strerror_r(e, janet_vm.strerror_buf, sizeof(janet_vm.strerror_buf));
#else #else
strerror_r(e, janet_vm.strerror_buf, sizeof(janet_vm.strerror_buf)); strerror_r(e, janet_vm.strerror_buf, sizeof(janet_vm.strerror_buf));
return janet_vm.strerror_buf; return janet_vm.strerror_buf;

View File

@ -39,7 +39,7 @@
(rmrf syspath) (rmrf syspath)
(os/mkdir syspath) (os/mkdir syspath)
(put root-env *syspath* (os/realpath syspath)) (put root-env *syspath* (os/realpath syspath))
(setdyn *out* @"") #(setdyn *out* @"")
(assert (empty? (bundle/list)) "initial bundle/list") (assert (empty? (bundle/list)) "initial bundle/list")
(assert (empty? (bundle/topolist)) "initial bundle/topolist") (assert (empty? (bundle/topolist)) "initial bundle/topolist")
@ -49,7 +49,6 @@
# Install deps (dep1 as :auto-remove) # Install deps (dep1 as :auto-remove)
(assert-no-error "sample-dep2" (assert-no-error "sample-dep2"
(print (dyn *syspath*))
(bundle/install "./examples/sample-dep2")) (bundle/install "./examples/sample-dep2"))
(assert-no-error "sample-dep1" (bundle/install "./examples/sample-dep1")) (assert-no-error "sample-dep1" (bundle/install "./examples/sample-dep1"))
(assert-no-error "sample-dep2 reinstall" (bundle/reinstall "sample-dep2")) (assert-no-error "sample-dep2 reinstall" (bundle/reinstall "sample-dep2"))