Closed sogaiu closed 3 months ago
Thank you for exploring bundle corners!
Possibly relevant bit from jpm
man page:
JANET_BINPATH
The directory where jpm will install binary scripts and
executables to. Defaults to (dyn :syspath)/bin The
--binpath=/some/path will override this variable.
Perhaps this commit may contain something that will help with this issue.
Using a janet with the commit mentioned in the previous comment, the following diff seems to get things to work:
diff --git a/bundle/init.janet b/bundle/init.janet
index b0c2dd7..5a5d7eb 100644
--- a/bundle/init.janet
+++ b/bundle/init.janet
@@ -3,6 +3,10 @@
(defn install [m &]
(bundle/add-file m "src/tarray.h" "tarray.h")
+ (each file (os/dir "bin")
+ (def f (string "bin/" file))
+ (when (= (os/stat f :mode) :file)
+ (bundle/add-bin m f)))
(bundle/add m "spork")
(each file (os/dir "build")
(def f (string "build/" file))
...but perhaps it feels a bit repetitive?
Here's another attempt:
diff --git a/bundle/init.janet b/bundle/init.janet
index b0c2dd7..5cb40b3 100644
--- a/bundle/init.janet
+++ b/bundle/init.janet
@@ -4,10 +4,15 @@
(defn install [m &]
(bundle/add-file m "src/tarray.h" "tarray.h")
(bundle/add m "spork")
- (each file (os/dir "build")
- (def f (string "build/" file))
- (when (= (os/stat f :mode) :file)
- (bundle/add-file m f (string "spork/" file)))))
+ (each dir ["bin" "build"]
+ (each file (os/dir dir)
+ (def f (string dir "/" file))
+ (when (= (os/stat f :mode) :file)
+ (cond
+ (= "bin" dir)
+ (bundle/add-bin m f)
+ (= "build" dir)
+ (bundle/add-file m f (string "spork/" file)))))))
(defn clean [&]
(sh/rm "build"))
Not sure if that's a net win...
As another piece of info regarding destinations, there is this line in jpm's source:
:binpath (string prefix "/bin")
I guess this tends to end up at a different location compared to (dyn *syspath*)/bin
as prefix
is typically something like /usr/local
or $HOME/.local
.
Probably obvious, but IIUC the above is for *nixy systems and doesn't apply as-is for Windows.
So taking a look at this, spork should be updated now.
As for binpath, we are taking a different approach with installing scripts with bundle. All scripts will now just be installed to (string (dyn *syspath*) "/bin")
, and the user would be expected to modify their path. If you wanted to actually put scripts in /usr/bin or similar, one could use a symlink. This avoids extra configuration as well as makes it clear these scripts are installed by bundle/install
.
Thanks for the clarification.
After installing via
(bundle/install ".")
, I don't getjanet-netrepl
orjanet-format
on myPATH
.May be they need to get mentioned in bundle/init.janet?
I wasn't sure how to indicate where they should get installed. In some testing, I used a destination via relative paths, but wasn't confident that is advisable.
Something like: