comparison lisp/packages.el @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents 1d62742628b6
children 6240c7796c7a
comparison
equal deleted inserted replaced
370:bd866891f083 371:cc15677e0335
60 (defvar packages-hierarchy-depth 1 60 (defvar packages-hierarchy-depth 1
61 "Depth of package hierarchies.") 61 "Depth of package hierarchies.")
62 62
63 (defvar packages-load-path-depth 1 63 (defvar packages-load-path-depth 1
64 "Depth of load-path search in package hierarchies.") 64 "Depth of load-path search in package hierarchies.")
65
66 (defvar packages-data-path-depth 1
67 "Depth of data-path search in package hierarchies.")
68 65
69 (defvar early-packages nil 66 (defvar early-packages nil
70 "Packages early in the load path.") 67 "Packages early in the load path.")
71 68
72 (defvar early-package-load-path nil 69 (defvar early-package-load-path nil
134 ((< (package-get-key name :version) version) 131 ((< (package-get-key name :version) version)
135 (error "Need version %g of package %s, got version %g" 132 (error "Need version %g of package %s, got version %g"
136 version name (cdr pkg))) 133 version name (cdr pkg)))
137 (t t)))) 134 (t t))))
138 135
139 (defun package-delete-name (name)
140 (let (pkg)
141 ;; Delete ALL versions of package.
142 ;; This is pretty memory-intensive, as we use copy-alist when deleting
143 ;; package entries, to prevent side-effects in functions that call this
144 ;; one.
145 (while (setq pkg (assq name packages-package-list))
146 (setq packages-package-list (delete pkg (copy-alist
147 packages-package-list)))
148 )
149 ))
150
151 ;;; Build time stuff 136 ;;; Build time stuff
152 137
153 (defvar autoload-file-name "auto-autoloads.el" 138 (defvar autoload-file-name "auto-autoloads.el"
154 "Filename that autoloads are expected to be found in.") 139 "Filename that autoloads are expected to be found in.")
155 140
201 (cond ((or (rassq 'jka-compr-handler file-name-handler-alist) 186 (cond ((or (rassq 'jka-compr-handler file-name-handler-alist)
202 (and (boundp 'find-file-hooks) 187 (and (boundp 'find-file-hooks)
203 (member 'crypt-find-file-hook find-file-hooks))) 188 (member 'crypt-find-file-hook find-file-hooks)))
204 ;; Compression involved. 189 ;; Compression involved.
205 (if nosuffix 190 (if nosuffix
206 ":.gz:.bz2:.Z" 191 ":.gz:.Z"
207 ".elc:.elc.gz:.elc.bz2:.elc.Z:.el:.el.gz:.el.bz2:.el.Z::.gz:.bz2:.Z")) 192 ".elc:.elc.gz:elc.Z:.el:.el.gz:.el.Z::.gz:.Z"))
208 (t 193 (t
209 ;; No compression. 194 ;; No compression.
210 (if nosuffix 195 (if nosuffix
211 "" 196 ""
212 ".elc:.el:"))) 197 ".elc:.el:")))
233 autoload-file-name) 218 autoload-file-name)
234 autoloads))) 219 autoloads)))
235 (setq path (cdr path))) 220 (setq path (cdr path)))
236 autoloads)) 221 autoloads))
237 222
238 (defun packages-list-autoloads (source-directory) 223 (defun packages-list-autoloads ()
239 "List autoload files in (what will be) the normal lisp search path. 224 "List autoload files in (what will be) the normal lisp search path.
240 This function is used during build to find where the global symbol files so 225 This function is used during build to find where the global symbol files so
241 they can be perused for their useful information." 226 they can be perused for their useful information."
227 ;; Source directory may not be initialized yet.
228 ;; (print (prin1-to-string load-path))
229 (if (null source-directory)
230 (setq source-directory (car load-path)))
242 (let ((files (directory-files (file-name-as-directory source-directory) 231 (let ((files (directory-files (file-name-as-directory source-directory)
243 t ".*")) 232 t ".*"))
244 file autolist) 233 file autolist)
245 ;; (print (prin1-to-string source-directory)) 234 ;; (print (prin1-to-string source-directory))
246 ;; (print (prin1-to-string files)) 235 ;; (print (prin1-to-string files))
303 (setq autoload-list (cdr autoload-list))))) 292 (setq autoload-list (cdr autoload-list)))))
304 293
305 ;; Data-directory is really a list now. Provide something to search it for 294 ;; Data-directory is really a list now. Provide something to search it for
306 ;; directories. 295 ;; directories.
307 296
308 (defun locate-data-directory-list (name &optional dir-list)
309 "Locate the matching list of directories in a search path DIR-LIST.
310 If no DIR-LIST is supplied, it defaults to `data-directory-list'."
311 (unless dir-list
312 (setq dir-list data-directory-list))
313 (let (found found-dir found-dir-list)
314 (while dir-list
315 (setq found (file-name-as-directory (concat (car dir-list) name))
316 found-dir (file-directory-p found))
317 (and found-dir
318 (setq found-dir-list (cons found found-dir-list)))
319 (setq dir-list (cdr dir-list)))
320 (nreverse found-dir-list)))
321
322 ;; Data-directory is really a list now. Provide something to search it for
323 ;; a directory.
324
325 (defun locate-data-directory (name &optional dir-list) 297 (defun locate-data-directory (name &optional dir-list)
326 "Locate a directory in a search path DIR-LIST (a list of directories). 298 "Locate a directory in a search path DIR-LIST (a list of directories).
327 If no DIR-LIST is supplied, it defaults to `data-directory-list'." 299 If no DIR-LIST is supplied, it defaults to `data-directory-list'."
328 (unless dir-list 300 (unless dir-list
329 (setq dir-list data-directory-list)) 301 (setq dir-list data-directory-list))
357 (site-directory (paths-find-site-directory roots base))) 329 (site-directory (paths-find-site-directory roots base)))
358 (paths-uniq-append 330 (paths-uniq-append
359 (and version-directory (list version-directory)) 331 (and version-directory (list version-directory))
360 (and site-directory (list site-directory))))) 332 (and site-directory (list site-directory)))))
361 333
362 (defvar packages-special-base-regexp "^\\(etc\\|info\\|lisp\\|lib-src\\|bin\\|pkginfo\\|man\\)$" 334 (defvar packages-special-base-regexp "^\\(etc\\|info\\|lisp\\|lib-src\\|bin\\)$"
363 "Special subdirectories of packages.") 335 "Special subdirectories of packages.")
364 336
365 (defvar packages-no-package-hierarchy-regexp 337 (defvar packages-no-package-hierarchy-regexp
366 (concat "\\(" paths-version-control-filename-regexp "\\)" 338 (concat "\\(" paths-version-control-filename-regexp "\\)"
367 "\\|" 339 "\\|"
471 (packages-find-package-library-path packages 443 (packages-find-package-library-path packages
472 '("lisp")) 444 '("lisp"))
473 packages-load-path-depth)) 445 packages-load-path-depth))
474 446
475 (defun packages-find-package-exec-path (packages) 447 (defun packages-find-package-exec-path (packages)
476 "Construct the exec-path component for packages.
477 PACKAGES is a list of package directories."
478 (packages-find-package-library-path packages 448 (packages-find-package-library-path packages
479 (list (paths-construct-path 449 (list (paths-construct-path
480 (list "bin" system-configuration)) 450 (list "bin" system-configuration))
481 "lib-src"))) 451 "lib-src")))
482 452
483 (defun packages-find-package-info-path (packages) 453 (defun packages-find-package-info-path (packages)
484 "Construct the info-path component for packages.
485 PACKAGES is a list of package directories."
486 (packages-find-package-library-path packages '("info"))) 454 (packages-find-package-library-path packages '("info")))
487 455
488 (defun packages-find-package-data-path (packages) 456 (defun packages-find-package-data-path (packages)
489 "Construct the data-path component for packages. 457 (packages-find-package-library-path packages '("etc")))
490 PACKAGES is a list of package directories."
491 (paths-find-recursive-load-path
492 (packages-find-package-library-path packages
493 '("etc"))
494 packages-data-path-depth))
495 458
496 ;; Loading package initialization files 459 ;; Loading package initialization files
497 460
498 (defun packages-load-package-lisps (package-load-path base) 461 (defun packages-load-package-lisps (package-load-path base)
499 "Load all Lisp files of a certain name along a load path. 462 "Load all Lisp files of a certain name along a load path.