comparison lisp/packages.el @ 3179:15139dbf89f4

[xemacs-hg @ 2005-12-27 18:50:47 by michaels] This: 2005-11-25 Mike Sperber <mike@xemacs.org> * CHANGES-beta: * configure.ac: Zap --with-package-prefix; instead, add --with-user-packages/--with-early-packages, --with-system-packages/--with-late-packages, and --with-legacy-packages/--with-last-packages. ... and the changes that result from it throughout the code.
author michaels
date Tue, 27 Dec 2005 18:51:30 +0000
parents 8dc793d1d990
children 072ccc89ac3c
comparison
equal deleted inserted replaced
3178:632fdf307588 3179:15139dbf89f4
343 PACKAGE-DIRECTORIES is a list of package directories. 343 PACKAGE-DIRECTORIES is a list of package directories.
344 BASE is a subdirectory name for the hierarchy. 344 BASE is a subdirectory name for the hierarchy.
345 Returns list of hierarchies." 345 Returns list of hierarchies."
346 (paths-directories-which-exist 346 (paths-directories-which-exist
347 (mapcar #'(lambda (package-directory) 347 (mapcar #'(lambda (package-directory)
348 (file-name-as-directory (concat package-directory base))) 348 (file-name-as-directory
349 (concat (file-name-as-directory package-directory)
350 base)))
349 package-directories))) 351 package-directories)))
350 352
351 (defun packages-split-path (path) 353 (defun packages-split-path (path)
352 "Split PATH at \"\", return pair with two components. 354 "Split PATH at \"\", return pair with two components.
353 The second component is shared with PATH." 355 The second component is shared with PATH."
385 "Find the package directories in the XEmacs installation. 387 "Find the package directories in the XEmacs installation.
386 ROOTS is a list of installation roots." 388 ROOTS is a list of installation roots."
387 (paths-uniq-append (paths-find-version-directories roots "" nil nil t) 389 (paths-uniq-append (paths-find-version-directories roots "" nil nil t)
388 (paths-find-site-directories roots ""))) 390 (paths-find-site-directories roots "")))
389 391
390 (defun packages-find-package-hierarchies (package-directories &optional default) 392 (defun packages-find-package-hierarchies (package-directories &optional envvar default)
391 "Find package hierarchies in a list of package directories. 393 "Find package hierarchies in a list of package directories.
392 PACKAGE-DIRECTORIES is a list of package directories. 394 PACKAGE-DIRECTORIES is a list of package directories.
393 DEFAULT is a default list of package hierarchies." 395 DEFAULT is a default list of package hierarchies.
394 (or default 396 ENVVAR is the name of an environment variable that may override
395 (let ((package-hierarchies '()) 397 the default."
396 (hierarchy-directories (packages-package-hierarchy-directory-names))) 398 (let* ((envvar-value (and envvar (getenv envvar)))
397 (while hierarchy-directories 399 (package-directories
398 (setq package-hierarchies 400 (if envvar-value
399 (nconc package-hierarchies 401 (split-path envvar-value)
400 (packages-find-package-hierarchies-named 402 package-directories)))
401 package-directories 403
402 (car hierarchy-directories)))) 404 (or (and (not envvar-value) default)
403 (setq hierarchy-directories (cdr hierarchy-directories))) 405 (let ((package-hierarchies '())
404 package-hierarchies))) 406 (hierarchy-directories (packages-package-hierarchy-directory-names)))
407 (while hierarchy-directories
408 (setq package-hierarchies
409 (nconc package-hierarchies
410 (packages-find-package-hierarchies-named
411 package-directories
412 (car hierarchy-directories))))
413 (setq hierarchy-directories (cdr hierarchy-directories)))
414 package-hierarchies))))
405 415
406 (defun packages-find-all-package-hierarchies (roots) 416 (defun packages-find-all-package-hierarchies (roots)
407 "Find the package hierarchies. 417 "Find the package hierarchies.
408 ROOTS is a list of installation roots. 418 ROOTS is a list of installation roots.
409 Returns a list of three directory lists, the first being the list of early 419 Returns a list of three directory lists, the first being the list of early
410 hierarchies, the second that of the late hierarchies, and the third the 420 hierarchies, the second that of the late hierarchies, and the third the
411 list of the last hierarchies." 421 list of the last hierarchies."
422 ;; EMACSPACKAGEPATH is a historical kludge
412 (let ((envvar-value (getenv "EMACSPACKAGEPATH"))) 423 (let ((envvar-value (getenv "EMACSPACKAGEPATH")))
413 (if envvar-value 424 (cond
414 (packages-split-package-path (paths-decode-directory-path envvar-value)) 425 (envvar-value
426 (packages-split-package-path (paths-decode-directory-path envvar-value)))
427 (configure-package-path
415 (packages-deconstruct 428 (packages-deconstruct
416 (packages-split-package-path configure-package-path) 429 (packages-split-package-path configure-package-path)
417 #'(lambda (configure-early-package-hierarchies 430 #'(lambda (early late last)
418 configure-late-package-hierarchies
419 configure-last-package-hierarchies)
420 (list 431 (list
421 (packages-find-package-hierarchies (list user-init-directory) 432 (packages-find-package-hierarchies (list user-init-directory)
422 configure-early-package-hierarchies) 433 "EMACSEARLYPACKAGES"
434 early)
423 (packages-find-package-hierarchies (packages-find-installation-package-directories roots) 435 (packages-find-package-hierarchies (packages-find-installation-package-directories roots)
424 configure-late-package-hierarchies) 436 "EMACSLATEPACKAGES"
437
438 late)
425 (packages-find-package-hierarchies '() 439 (packages-find-package-hierarchies '()
426 configure-last-package-hierarchies))))))) 440 "EMACSLASTPACKAGES"
427 441 last)))))
442 (t
443 (list
444 (packages-find-package-hierarchies (or configure-early-package-directories
445 (list user-init-directory))
446 "EMACSEARLYPACKAGES")
447 (packages-find-package-hierarchies (or configure-late-package-directories
448 (packages-find-installation-package-directories roots))
449 "EMACSLATEPACKAGES")
450 (packages-find-package-hierarchies configure-last-package-directories
451 "EMACSLASTPACKAGES"))))))
452
428 (defun packages-find-package-library-path (package-hierarchies suffixes) 453 (defun packages-find-package-library-path (package-hierarchies suffixes)
429 "Construct a path into a component of the packages hierarchy. 454 "Construct a path into a component of the packages hierarchy.
430 PACKAGE-HIERARCHIES is a list of package hierarchies. 455 PACKAGE-HIERARCHIES is a list of package hierarchies.
431 SUFFIXES is a list of names of hierarchy subdirectories to look for." 456 SUFFIXES is a list of names of hierarchy subdirectories to look for."
432 (let ((directories 457 (let ((directories