~subsetpark/bagatto

0be1807e51c07226da26145891ab8f61890f3ef3 — Zach Smith 3 months ago 4562bc9 14/import-natives
Add JANET_PATH to native paths as well
3 files changed, 20 insertions(+), 8 deletions(-)

M main.janet
M src/core.janet
M src/env.janet
M main.janet => main.janet +2 -1
@@ 32,13 32,14 @@
                                :required true}])

(defn main [& args]
  (env/prepare-paths!)
  (merge-into root-env bagatto)

  (let [args (argparse ;argparse-params)
        index (args :default)
        env (prepare-env index)]
    
    (env/prepare-environment! env)
    (env/load-env! env)

    (if (args "repl")
      # REPL mode: Enter a REPL to experiment with the contents of the

M src/core.janet => src/core.janet +3 -1
@@ 126,7 126,9 @@
                   _ (error/site-error with-defaults))))]

    (let [segments (-> (threads/distribute jobs) (values))]
      (array/concat ;segments))))
      (if ((complement empty?) segments)
        (array/concat ;segments)
        @[]))))

(defn evaluate-writer-specs
  ```

M src/env.janet => src/env.janet +15 -6
@@ 1,4 1,5 @@
(import temple)
(import path)
(import sh)

(def required-checks @{})


@@ 25,9 26,9 @@
      false)))

(defn- prepare-syspath! []
  (match (os/getenv "JANET_PATH")
    nil :ok
    janet-path (put root-env :syspath janet-path)))
  (when-let [janet-path (os/getenv "JANET_PATH")]
    (array/push module/paths [(path/join janet-path ":all::native:") :native])
    (put root-env :syspath janet-path)))

(defn add-exec-blacklist
  ```


@@ 42,11 43,19 @@
        (put blacklist check true)))
    (put env :executable-blacklist blacklist)))

(defn prepare-environment!
  [env]
(defn prepare-paths!
  []
  (prepare-syspath!)
  (temple/add-loader)
  (temple/add-loader))

(defn load-env!
  [env]
  # Monkey-patch the temple environment with the functions defined
  # in the index module.
  (merge-into temple/base-env env)
  (setdyn :executable-blacklist (env :executable-blacklist)))

(defn prepare-environment!
  [env]
  (prepare-paths!)
  (load-env! env))