Skip to content

Commit

Permalink
emacsql-pg: Require recent pg and disable on older Emacs releases
Browse files Browse the repository at this point in the history
  • Loading branch information
tarsius committed Jul 14, 2024
1 parent f2aa0ac commit 8aeffcf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TEST_ELS += tests/emacsql-tests.el
TEST_ELCS = $(TEST_ELS:.el=.elc)

DEPS = pg
DEPS += peg
DEPS += sqlite3

EMACS ?= emacs
Expand Down
9 changes: 6 additions & 3 deletions emacsql-pg.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@
;; Homepage: https://github.com/magit/emacsql

;; Package-Version: 3.1.1.50-git
;; Package-Requires: ((emacs "25.1") (emacsql "20230220") (pg "0.16"))
;; Package-Requires: ((emacs "28.1") (emacsql "20240623") (pg "0.37"))
;; SPDX-License-Identifier: Unlicense

;;; Commentary:

;; This library provides an EmacSQL back-end for PostgreSQL, which
;; uses the `pg' package to directly speak to the database.
;; uses the `pg' package to directly speak to the database. This
;; library requires at least Emacs 28.1.

;; (For an alternative back-end for PostgreSQL, see `emacsql-psql'.)

;;; Code:

(require 'emacsql)

(require 'pg nil t)
(if (>= emacs-major-version 28)
(require 'pg nil t)
(message "emacsql-pg.el requires Emacs 28.1 or later"))
(declare-function pg-connect "pg"
( dbname user &optional
(password "") (host "localhost") (port 5432) (tls nil)))
Expand Down
12 changes: 8 additions & 4 deletions tests/emacsql-external-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
(require 'emacsql-mysql)
(require 'emacsql-psql)
;; FIXME(CI) Broken and thus disabled in test.yml.
(if (require 'pg nil t)
(require 'emacsql-pg)
(message "WARNING: Forgo testing `%s' because `%s' is unavailable"
'emacsql-pg 'pg))
(cond
((< emacs-major-version 28)
(message "WARNING: Forgo testing `%s' because it is unsupported on Emacs %s"
'emacsql-pg emacs-version))
((require 'pg nil t)
(require 'emacsql-pg))
((message "WARNING: Forgo testing `%s' because `%s' is unavailable"
'emacsql-pg 'pg)))

(defvar emacsql-tests-timeout 4
"Be aggressive about not waiting on subprocesses in unit tests.")
Expand Down

0 comments on commit 8aeffcf

Please sign in to comment.