Package creation #21

wants to merge 4 commits into
1 .gitignore
@@ -21,3 +21,4 @@ tests/
11 Makefile
@@ -57,7 +57,7 @@ pymacs.pdf:
# The following goals for the maintainer of the Pymacs Web site.
ARCHIVES = web/src/archives
-VERSION = `grep '^version' | sed -e "s/'$$//" -e "s/.*'//"`
+VERSION := $(shell echo `grep '^version' | sed -e "s/'$$//" -e "s/.*'//"`)
pinard May 7, 2012

Why ?
And why not $(grep '^version' | sed -e "s/'$$//" -e "s/.*'//") ?

pinard May 7, 2012

I just checked the Makefile, and unless mistaken, I see no dependency on GNU make. This Makefile would run on any make. The $(...) construct and the := construct are not uniformly supported however, that's likely why I avoided them. Do you have any reason, related to packager support, to change this?

gleber May 7, 2012

Not exactly sure why. Probably I was trying to make it work and it was a way to make it work on my Ubuntu

publish: pppp.pdf pymacs.pdf pymacs.rst
find -name '*~' | xargs rm -fv
@@ -70,3 +70,12 @@ publish: pppp.pdf pymacs.pdf pymacs.rst
make-web -C web
synchro push alcyon -d entretien/pymacs
ssh alcyon 'make-web -C entretien/pymacs/web'
+package: all
+ @rm -rf pymacs-$(VERSION)/ pymacs-$(VERSION).tar
+ @rm -rf build/pymacs-$(VERSION)/ build/pymacs-$(VERSION).tar
+ mkdir -p pymacs-$(VERSION)/lib
+ cp pymacs-pkg.el pymacs.el pymacs-$(VERSION)/
pinard May 7, 2012

This freezes a post-processed copy of pymacs.el as per the packager configuration. For @VERSION@, this is no problem. For @PYTHON@ and @DEFADVICE_OK@, it might be more of a problem, as users installing the package might be using another Python (for the first case) or use Mac OS (for the second case).

gleber May 7, 2012

Frankly speaking I don't know exactly what are you referring to :) Feel free to fix it the way it works best for everyone!

pinard May 7, 2012

OK, I was not clear enough, sorry. In any case, there is no clear solution in sight. My only guess is that packaging should address some case considered to be "most usual", like maybe Python 2, and not running Mac OS. For anything else, Pymacs should be installed the "hard way", or maybe tuned after installation. We'll see how it goes, and acquire experience along the way...

+ cp pymacs-$(VERSION)/lib/
+ tar cfv pymacs-$(VERSION).tar pymacs-$(VERSION)/*
+ mv pymacs-$(VERSION).tar pymacs-$(VERSION)/ build/
@@ -0,0 +1 @@
+(define-package "pymacs" "@VERSION@" "Pymacs Interface between Emacs Lisp and Python")
@@ -41,6 +41,10 @@
(and (fboundp 'make-hash-table) (fboundp 'gethash) (fboundp 'puthash))
"Set to t if hash tables are available.")
+(defvar pymacs-lib-directory
pinard May 7, 2012

Why do we need a lib/ directory? Is that a requirement of the packager? If yes, then why the requirement?

gleber May 7, 2012

I don't think there's a requirement, but I feel it is better to "isolate" non-lisp files from lisp files. It seems to be more clean to me

pinard May 7, 2012

Well, if Pymacs was any sizable, yes. With only two files, it's a tiny project, not worth much structure!

+ (concat (file-name-directory load-file-name) "lib")
+ "Pymacs lib directory")
;; pymacs-cancel-timer
@@ -68,7 +72,7 @@
"Tell XEmacs if STRING should be handled as multibyte."
(not (member (find-charset-string string) '(nil (ascii))))))
- ; Tell XEmacs that STRING is unibyte, when Mule is not around!
+ ;; Tell XEmacs that STRING is unibyte, when Mule is not around!
(defalias 'pymacs-multibyte-string-p 'ignore)))
;; pymacs-report-error
@@ -84,7 +88,7 @@
;; pymacs-timerp
(defalias 'pymacs-timerp
(cond ((fboundp 'timerp) 'timerp)
- ; XEmacs case - yet having post-gc-hook, this is unused.
+ ;; XEmacs case - yet having post-gc-hook, this is unused.
((fboundp 'itimerp) 'itimerp)
(t 'ignore)))
@@ -298,7 +302,7 @@ equivalents, other structures are converted into Lisp handles."
(inhibit-file-name-operation operation))
(apply operation arguments)))
-;(add-to-list 'file-name-handler-alist '("\\.el\\'" . pymacs-file-handler))
+;;(add-to-list 'file-name-handler-alist '("\\.el\\'" . pymacs-file-handler))
;;; Gargabe collection of Python IDs.
@@ -566,18 +570,22 @@ The timer is used only if `post-gc-hook' is not available.")
(set-buffer-file-coding-system 'raw-text)
;; Launch the Pymacs helper.
- (let ((process
- (apply 'start-process "pymacs" buffer
- (let ((python (getenv "PYMACS_PYTHON")))
- (if (or (null python) (equal python ""))
- pymacs-python-command
- python))
- "-c" (concat "import sys;"
- " from Pymacs import main;"
- " main(*sys.argv[1:])")
- (append
- (and (>= emacs-major-version 24) '("-f"))
- (mapcar 'expand-file-name pymacs-load-path)))))
+ (let* ((command
+ (concat "import sys; "
+ (if (file-exists-p pymacs-lib-directory)
+ (format "sys.path.append(\"%s\"); " pymacs-lib-directory) "")
+ "from Pymacs import main; "
+ "main(*sys.argv[1:]) "))
+ (process
+ (apply 'start-process "pymacs" buffer
+ (let ((python (getenv "PYMACS_PYTHON")))
+ (if (or (null python) (equal python ""))
+ pymacs-python-command
+ python))
+ "-c" command
+ (append
+ (and (>= emacs-major-version 24) '("-f"))
+ (mapcar 'expand-file-name pymacs-load-path)))))
(pymacs-kill-without-query process)
;; Receive the synchronising reply.
(while (progn
@@ -586,7 +594,7 @@ The timer is used only if `post-gc-hook' is not available.")
(unless (accept-process-output process pymacs-timeout-at-start)
"Pymacs helper did not start within %d seconds"
- pymacs-timeout-at-start)))
+ pymacs-timeout-at-start)))
(let ((marker (process-mark process))
(limit-position (+ (match-end 0)
(string-to-number (match-string 1)))))
@@ -782,4 +790,4 @@ Killing the Pymacs helper might create zombie objects. Kill? "))
((consp expression) (not (cdr (last expression))))))
(provide 'pymacs)
-;;; pymacs.el ends here
+;;; pymacs.el ends here
@@ -18,7 +18,7 @@
package = 'Pymacs'
-version = '0.24-beta2'
+version = '0.24.3'
setup(name=package, version=version,
description="Interface between Emacs Lisp and Python",