Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 7d964825 authored by Dimitri Fontaine's avatar Dimitri Fontaine

Merge pull request #536 from mlf176f2/zip-method

HTTP-Zip method
parents b689342e de5a150d
......@@ -11,7 +11,6 @@
;; Install
;; Please see the README.asciidoc file from the same distribution
(require 'el-get-core)
......@@ -37,6 +36,7 @@
(require 'el-get-hg)
(require 'el-get-http)
(require 'el-get-http-tar)
(require 'el-get-http-zip)
(require 'el-get-pacman)
(require 'el-get-svn)
;;; el-get --- Manage the external elisp bits and pieces you depend upon
;; Copyright (C) 2010-2011 Dimitri Fontaine
;; Author: Dimitri Fontaine <dim@tapoueh.org>
;; URL: http://www.emacswiki.org/emacs/el-get
;; GIT: https://github.com/dimitri/el-get
;; Licence: WTFPL, grab your copy here: http://sam.zoy.org/wtfpl/
;; This file is NOT part of GNU Emacs.
;; Install
;; Please see the README.asciidoc file from the same distribution
(require 'el-get-http)
(defun el-get-http-zip-cleanup-extract-hook (package)
"Cleanup after unzip: if there's only one subdir, move all
the files up."
(let* ((pdir (el-get-package-directory package))
(url (plist-get (el-get-package-def package) :url))
(zipfile (el-get-filename-from-url url))
(files (remove zipfile (directory-files pdir nil "[^.]$")))
(dir (car files)))
;; if there's only one directory, move its content up and get rid of it
(el-get-verbose-message "el-get: unzip cleanup %s [%s]: %S" package pdir files)
(unless (cdr files)
(loop for fname in (directory-files
(expand-file-name dir pdir) nil "[^.]$")
for fullname = (expand-file-name fname (expand-file-name dir pdir))
for newname = (expand-file-name pdir fname)
do (progn
(el-get-verbose-message "%S %S %S" pdir dir fname)
(el-get-verbose-message "mv %S %S" fullname newname)
(rename-file fullname newname)))
(el-get-verbose-message "delete-directory: %s" (expand-file-name dir pdir))
(delete-directory (expand-file-name dir pdir)))))
(defun el-get-http-zip-install (package url post-install-fun)
"Dowload a zip archive package over HTTP."
(let* ((source (el-get-package-def package))
(options (plist-get source :options))
(pdir (el-get-package-directory package))
(zipfile (el-get-filename-from-url url))
(dest (concat (file-name-as-directory pdir) zipfile))
(name (format "*unzip %s %s*" options url))
(ok (format "Package %s installed." package))
(ko (format "Could not install package %s." package))
(post `(lambda (package)
;; zip xzf `basename url`
(let ((el-get-sources '(,@el-get-sources)))
'((:command-name ,name
:buffer-name ,name
:default-directory ,pdir
:program ,(executable-find "unzip")
:args (,@options ,zipfile)
:message ,ok
:error ,ko))
,(symbol-function post-install-fun))))))
(el-get-http-install package url post dest)))
(add-hook 'el-get-http-zip-install-hook 'el-get-http-zip-cleanup-extract-hook)
:http-zip #'el-get-http-zip-install #'el-get-http-zip-install #'el-get-rmdir
(provide 'el-get-http-zip)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment