comparison lisp/packages.el @ 420:41dbb7a9d5f2 r21-2-18

Import from CVS: tag r21-2-18
author cvs
date Mon, 13 Aug 2007 11:24:09 +0200
parents 697ef44129c6
children 11054d720c21
comparison
equal deleted inserted replaced
419:66615b78f1a5 420:41dbb7a9d5f2
53 ;;; Code: 53 ;;; Code:
54 54
55 ;;; Package versioning 55 ;;; Package versioning
56 56
57 (defvar packages-package-list nil 57 (defvar packages-package-list nil
58 "database of loaded packages and version numbers") 58 "Database of loaded packages and version numbers")
59 59
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
84 (defvar last-package-load-path nil 84 (defvar last-package-load-path nil
85 "Load path for packages last in the load path.") 85 "Load path for packages last in the load path.")
86 86
87 (defvar package-locations 87 (defvar package-locations
88 (list 88 (list
89 (list (paths-construct-path '("~" ".xemacs")) 89 (list (paths-construct-path '("~" ".xemacs" "mule-packages"))
90 'early #'(lambda () (featurep 'mule)))
91 (list (paths-construct-path '("~" ".xemacs" "xemacs-packages"))
90 'early #'(lambda () t)) 92 'early #'(lambda () t))
91 (list "site-packages" 'late #'(lambda () t)) 93 (list "site-packages" 'late #'(lambda () t))
92 (list "infodock-packages" 'late #'(lambda () (featurep 'infodock))) 94 (list "infodock-packages" 'late #'(lambda () (featurep 'infodock)))
93 (list "mule-packages" 'late #'(lambda () (featurep 'mule))) 95 (list "mule-packages" 'late #'(lambda () (featurep 'mule)))
94 (list "xemacs-packages" 'late #'(lambda () t)) 96 (list "xemacs-packages" 'late #'(lambda () t)))
95 (list "packages" 'late #'(lambda () t)))
96 "Locations of the various package directories. 97 "Locations of the various package directories.
97 This is a list each of whose elements describes one directory. 98 This is a list each of whose elements describes one directory.
98 A directory description is a three-element list. 99 A directory description is a three-element list.
99 The first element is either an absolute path or a subdirectory 100 The first element is either an absolute path or a subdirectory
100 in the XEmacs hierarchy. 101 in the XEmacs hierarchy.
120 121
121 (defun package-provide (name &rest attributes) 122 (defun package-provide (name &rest attributes)
122 (let ((info (if (and attributes (floatp (car attributes))) 123 (let ((info (if (and attributes (floatp (car attributes)))
123 (list :version (car attributes)) 124 (list :version (car attributes))
124 attributes))) 125 attributes)))
125 (remassq name packages-package-list)
126 (setq packages-package-list 126 (setq packages-package-list
127 (cons (cons name info) packages-package-list)))) 127 (cons (cons name info) (remassq name packages-package-list)))))
128 128
129 (defun package-require (name version) 129 (defun package-require (name version)
130 (let ((pkg (assq name packages-package-list))) 130 (let ((pkg (assq name packages-package-list)))
131 (cond ((null pkg) 131 (cond ((null pkg)
132 (error "Package %s has not been loaded into this XEmacsen" 132 (error "Package %s has not been loaded into this XEmacsen"
450 "Construct a path into a component of the packages hierarchy. 450 "Construct a path into a component of the packages hierarchy.
451 PACKAGES is a list of package directories. 451 PACKAGES is a list of package directories.
452 SUFFIXES is a list of names of package subdirectories to look for." 452 SUFFIXES is a list of names of package subdirectories to look for."
453 (let ((directories 453 (let ((directories
454 (apply 454 (apply
455 #'append 455 #'nconc
456 (mapcar #'(lambda (package) 456 (mapcar #'(lambda (package)
457 (mapcar #'(lambda (suffix) 457 (mapcar #'(lambda (suffix)
458 (file-name-as-directory (concat package suffix))) 458 (file-name-as-directory (concat package suffix)))
459 suffixes)) 459 suffixes))
460 packages)))) 460 packages))))