emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/sqlite3 a69ff5a456 11/62: github installation function add


From: ELPA Syncer
Subject: [nongnu] elpa/sqlite3 a69ff5a456 11/62: github installation function added
Date: Tue, 14 Mar 2023 11:01:45 -0400 (EDT)

branch: elpa/sqlite3
commit a69ff5a456f141a4139300530207e815456da063
Author: Y. N. Lo <gordonynlo@yahoo.com>
Commit: Y. N. Lo <gordonynlo@yahoo.com>

    github installation function added
---
 sqlite3-api.el | 43 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/sqlite3-api.el b/sqlite3-api.el
index 948a19971d..fdc67201ad 100644
--- a/sqlite3-api.el
+++ b/sqlite3-api.el
@@ -11,10 +11,51 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+;; sqlite-* constants
 (require 'sqlite3-api-constants)
-(require 'sqlite3-api-module)
 
+;; Dynamic module
+(require 'sqlite3-api-module nil t)
+
+;; Error signals raised by the dynamic module
 (define-error 'db-error "Database Error")
 (define-error 'sql-error "SQL Error")
 
+;; Install dynamic module
+(defun sqlite3-api-install-dynamic-module ()
+  "Install sqlite3-api-module from github."
+  (interactive)
+  (let ((log-buffer "*sqlite3-api-install-log*")
+       (err-buffer "*sqlite3-api-install-error*")
+       (tmp-dir (make-temp-file "sqlite3-api" t))
+       (cur-dir default-directory)
+       (repo-url "https://github.com/pekingduck/emacs-sqlite3-api";)
+       (tar))
+    (unwind-protect
+       (condition-case err
+           (progn
+             (when (get-buffer log-buffer)
+               (kill-buffer log-buffer))
+             (when (get-buffer err-buffer)
+               (kill-buffer err-buffer))
+             (cd tmp-dir)
+             (shell-command (format "git clone %s" repo-url)
+                            log-buffer err-buffer)
+             (cd "emacs-sqlite3-api")
+             ;; compile the module and create a tar archive
+             (shell-command "make module" log-buffer err-buffer)
+             ;; A file called "MODULE" is created in the previous step
+             ;; and it contains the name of the tar file
+             (setq tar (with-temp-buffer
+                         (insert-file-contents "MODULE")
+                         (buffer-substring-no-properties
+                          (point-min)
+                          (1- (point-max)))))
+             (package-install-file tar)
+             (message "%s successfully installed" (file-name-base tar)))
+         (error
+          (message "Installation aborted: %S" err)))
+      (delete-directory tmp-dir t)
+      (cd cur-dir))))
+
 (provide 'sqlite3-api)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]