Add fallback for Apple M1 (#46)
This commit is contained in:
parent
842ff34739
commit
e075b13bfe
1 changed files with 22 additions and 16 deletions
|
|
@ -23,22 +23,28 @@
|
||||||
(binding [*out* *err*]
|
(binding [*out* *err*]
|
||||||
(apply println strs)))
|
(apply println strs)))
|
||||||
|
|
||||||
(defn match-artifacts [package]
|
(defn match-artifacts
|
||||||
(let [artifacts (:pod/artifacts package)
|
([package] (match-artifacts package (:os/arch os)))
|
||||||
res (filter (fn [{os-name :os/name
|
([package arch]
|
||||||
os-arch :os/arch}]
|
(let [artifacts (:pod/artifacts package)
|
||||||
(let [os-arch (normalize-arch os-arch)]
|
res (filter (fn [{os-name :os/name
|
||||||
(and (re-matches (re-pattern os-name) (:os/name os))
|
os-arch :os/arch}]
|
||||||
(re-matches (re-pattern os-arch)
|
(let [os-arch (normalize-arch os-arch)]
|
||||||
(:os/arch os)))))
|
(and (re-matches (re-pattern os-name) (:os/name os))
|
||||||
artifacts)]
|
(re-matches (re-pattern os-arch)
|
||||||
(when (empty? res)
|
arch))))
|
||||||
(throw (IllegalArgumentException. (format "No executable found for pod %s (%s) and OS %s/%s"
|
artifacts)]
|
||||||
(:pod/name package)
|
(if (empty? res)
|
||||||
(:pod/version package)
|
(if (and (= "Mac OS X" (:os/name os))
|
||||||
(:os/name os)
|
(= "aarch64" (:os/arch os)))
|
||||||
(:os/arch os)))))
|
;; Rosetta2 fallback on Apple M1 machines
|
||||||
res))
|
(match-artifacts package "x86_64")
|
||||||
|
(throw (IllegalArgumentException. (format "No executable found for pod %s (%s) and OS %s/%s"
|
||||||
|
(:pod/name package)
|
||||||
|
(:pod/version package)
|
||||||
|
(:os/name os)
|
||||||
|
(:os/arch os)))))
|
||||||
|
res))))
|
||||||
|
|
||||||
(defn unzip [{:keys [^java.io.File zip-file
|
(defn unzip [{:keys [^java.io.File zip-file
|
||||||
^java.io.File destination-dir
|
^java.io.File destination-dir
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue