comparison lisp/packages.el @ 373:6240c7796c7a r21-2b2

Import from CVS: tag r21-2b2
author cvs
date Mon, 13 Aug 2007 11:04:06 +0200
parents cc15677e0335
children 74fd4e045ea6
comparison
equal deleted inserted replaced
372:49e1ed2d7ed8 373:6240c7796c7a
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.")
65 68
66 (defvar early-packages nil 69 (defvar early-packages nil
67 "Packages early in the load path.") 70 "Packages early in the load path.")
68 71
69 (defvar early-package-load-path nil 72 (defvar early-package-load-path nil
130 name)) 133 name))
131 ((< (package-get-key name :version) version) 134 ((< (package-get-key name :version) version)
132 (error "Need version %g of package %s, got version %g" 135 (error "Need version %g of package %s, got version %g"
133 version name (cdr pkg))) 136 version name (cdr pkg)))
134 (t t)))) 137 (t t))))
138
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 ))
135 150
136 ;;; Build time stuff 151 ;;; Build time stuff
137 152
138 (defvar autoload-file-name "auto-autoloads.el" 153 (defvar autoload-file-name "auto-autoloads.el"
139 "Filename that autoloads are expected to be found in.") 154 "Filename that autoloads are expected to be found in.")
218 autoload-file-name) 233 autoload-file-name)
219 autoloads))) 234 autoloads)))
220 (setq path (cdr path))) 235 (setq path (cdr path)))
221 autoloads)) 236 autoloads))
222 237
223 (defun packages-list-autoloads () 238 (defun packages-list-autoloads (source-directory)
224 "List autoload files in (what will be) the normal lisp search path. 239 "List autoload files in (what will be) the normal lisp search path.
225 This function is used during build to find where the global symbol files so 240 This function is used during build to find where the global symbol files so
226 they can be perused for their useful information." 241 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)))
231 (let ((files (directory-files (file-name-as-directory source-directory) 242 (let ((files (directory-files (file-name-as-directory source-directory)
232 t ".*")) 243 t ".*"))
233 file autolist) 244 file autolist)
234 ;; (print (prin1-to-string source-directory)) 245 ;; (print (prin1-to-string source-directory))
235 ;; (print (prin1-to-string files)) 246 ;; (print (prin1-to-string files))
292 (setq autoload-list (cdr autoload-list))))) 303 (setq autoload-list (cdr autoload-list)))))
293 304
294 ;; Data-directory is really a list now. Provide something to search it for 305 ;; Data-directory is really a list now. Provide something to search it for
295 ;; directories. 306 ;; directories.
296 307
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
297 (defun locate-data-directory (name &optional dir-list) 325 (defun locate-data-directory (name &optional dir-list)
298 "Locate a directory in a search path DIR-LIST (a list of directories). 326 "Locate a directory in a search path DIR-LIST (a list of directories).
299 If no DIR-LIST is supplied, it defaults to `data-directory-list'." 327 If no DIR-LIST is supplied, it defaults to `data-directory-list'."
300 (unless dir-list 328 (unless dir-list
301 (setq dir-list data-directory-list)) 329 (setq dir-list data-directory-list))
329 (site-directory (paths-find-site-directory roots base))) 357 (site-directory (paths-find-site-directory roots base)))
330 (paths-uniq-append 358 (paths-uniq-append
331 (and version-directory (list version-directory)) 359 (and version-directory (list version-directory))
332 (and site-directory (list site-directory))))) 360 (and site-directory (list site-directory)))))
333 361
334 (defvar packages-special-base-regexp "^\\(etc\\|info\\|lisp\\|lib-src\\|bin\\)$" 362 (defvar packages-special-base-regexp "^\\(etc\\|info\\|lisp\\|lib-src\\|bin\\|pkginfo\\)$"
335 "Special subdirectories of packages.") 363 "Special subdirectories of packages.")
336 364
337 (defvar packages-no-package-hierarchy-regexp 365 (defvar packages-no-package-hierarchy-regexp
338 (concat "\\(" paths-version-control-filename-regexp "\\)" 366 (concat "\\(" paths-version-control-filename-regexp "\\)"
339 "\\|" 367 "\\|"
443 (packages-find-package-library-path packages 471 (packages-find-package-library-path packages
444 '("lisp")) 472 '("lisp"))
445 packages-load-path-depth)) 473 packages-load-path-depth))
446 474
447 (defun packages-find-package-exec-path (packages) 475 (defun packages-find-package-exec-path (packages)
476 "Construct the exec-path component for packages.
477 PACKAGES is a list of package directories."
448 (packages-find-package-library-path packages 478 (packages-find-package-library-path packages
449 (list (paths-construct-path 479 (list (paths-construct-path
450 (list "bin" system-configuration)) 480 (list "bin" system-configuration))
451 "lib-src"))) 481 "lib-src")))
452 482
453 (defun packages-find-package-info-path (packages) 483 (defun packages-find-package-info-path (packages)
484 "Construct the info-path component for packages.
485 PACKAGES is a list of package directories."
454 (packages-find-package-library-path packages '("info"))) 486 (packages-find-package-library-path packages '("info")))
455 487
456 (defun packages-find-package-data-path (packages) 488 (defun packages-find-package-data-path (packages)
457 (packages-find-package-library-path packages '("etc"))) 489 "Construct the data-path component for packages.
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))
458 495
459 ;; Loading package initialization files 496 ;; Loading package initialization files
460 497
461 (defun packages-load-package-lisps (package-load-path base) 498 (defun packages-load-package-lisps (package-load-path base)
462 "Load all Lisp files of a certain name along a load path. 499 "Load all Lisp files of a certain name along a load path.