Ignore files in .elpaignore during byte compilation
* package.el (package--parse-elpaignore): Add new function. (package--compile): Bind 'byte-compile-ignore-files' to the result of 'package--parse-elpaignore'.
This commit is contained in:
parent
878cacc712
commit
9ddc23cd34
3 changed files with 27 additions and 2 deletions
|
@ -29,7 +29,6 @@
|
|||
;; - Allow for automatic updating TODO
|
||||
;; * Detect merge conflicts TODO
|
||||
;; * Check if there are upstream changes TODO
|
||||
;; - Respect the .elpaignore file TODO
|
||||
;; - Allow finding revisions that bump the version tag TODO
|
||||
;; * Allow for `package-vc-fetch' to use the version
|
||||
;; of the package if already installed.
|
||||
|
|
|
@ -599,6 +599,25 @@ package."
|
|||
"Return the priority of the archive of package-desc object PKG-DESC."
|
||||
(package-archive-priority (package-desc-archive pkg-desc)))
|
||||
|
||||
(defun package--parse-elpaignore (pkg-desc)
|
||||
"Return the of regular expression to match files ignored by PKG-DESC."
|
||||
(let* ((pkg-dir (file-name-as-directory (package-desc-dir pkg-desc)))
|
||||
(ignore (expand-file-name ".elpaignore" pkg-dir))
|
||||
files)
|
||||
(when (file-exists-p ignore)
|
||||
(with-temp-buffer
|
||||
(insert-file-contents ignore)
|
||||
(goto-char (point-min))
|
||||
(while (not (eobp))
|
||||
(push (wildcard-to-regexp
|
||||
(let ((line (buffer-substring
|
||||
(line-beginning-position)
|
||||
(line-end-position))))
|
||||
(file-name-concat pkg-dir (string-trim-left line "/"))))
|
||||
files)
|
||||
(forward-line)))
|
||||
files)))
|
||||
|
||||
(cl-defstruct (package--bi-desc
|
||||
(:constructor package-make-builtin (version summary))
|
||||
(:type vector))
|
||||
|
@ -1073,11 +1092,13 @@ untar into a directory named DIR; otherwise, signal an error."
|
|||
|
||||
;;;; Compilation
|
||||
(defvar warning-minimum-level)
|
||||
(defvar byte-compile-ignore-files)
|
||||
(defun package--compile (pkg-desc)
|
||||
"Byte-compile installed package PKG-DESC.
|
||||
This assumes that `pkg-desc' has already been activated with
|
||||
`package-activate-1'."
|
||||
(let ((warning-minimum-level :error)
|
||||
(let ((byte-compile-ignore-files (package--parse-elpaignore pkg-desc))
|
||||
(warning-minimum-level :error)
|
||||
(load-path load-path))
|
||||
(byte-recompile-directory (package-desc-dir pkg-desc) 0 t)))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue