From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Bavier Subject: Re: [PATCH] gnu: Add Cython Date: Mon, 20 Oct 2014 16:15:25 -0500 Message-ID: <87vbnetpci.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgKGG-000180-6w for guix-devel@gnu.org; Mon, 20 Oct 2014 17:13:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgKGB-0006EA-Ja for guix-devel@gnu.org; Mon, 20 Oct 2014 17:13:04 -0400 Received: from mail-ie0-x229.google.com ([2607:f8b0:4001:c03::229]:60032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgKGB-0006E4-C0 for guix-devel@gnu.org; Mon, 20 Oct 2014 17:12:59 -0400 Received: by mail-ie0-f169.google.com with SMTP id tp5so5684730ieb.0 for ; Mon, 20 Oct 2014 14:12:58 -0700 (PDT) In-reply-to: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Federico Beffa Cc: Guix-devel Federico Beffa writes: > In preparing this package I've found that the python-build-system (not > sure about the others) defines the environment variable HOME as > "/homeless-shelter". However, that directory does not exist in the > build chroot. This is a problem for cython, because it wants to access > $HOME/.cython. Wouldn't it be better to point HOME to an existing > directory (created in the chroot) with suitable permissions? It's not a common need when building packages. There are a few other packages that need an existing, writable $HOME when building or testing. > I'm a little bit unsure about the name of the package. I've not > prefixed it with "python[2]-" as the program extends the Python > language and can work with both (2 and 3) Python version series. > However, the package installs files in > ".../lib/python${version}/site-packages/...". The naming is in-line > with Debian naming. What you did seems reasonable to me. > From b9e7cdb367518547be3d8bc535828a0d1f1ac96e Mon Sep 17 00:00:00 2001 > From: Federico Beffa > Date: Mon, 20 Oct 2014 19:52:45 +0200 > Subject: [PATCH] gnu: Add Cython > > * gnu/packages/python.scm(cython,cython2): New variables Period "." at the end. > --- > gnu/packages/python.scm | 50 > +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 50 insertions(+) > > diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm > index 897e248..f8503c3 100644 > --- a/gnu/packages/python.scm > +++ b/gnu/packages/python.scm > @@ -37,6 +37,7 @@ > #:use-module (gnu packages pkg-config) > #:use-module (gnu packages databases) > #:use-module (gnu packages zip) > + #:use-module (gnu packages gcc) I don't see what prompts this new module. Leftover from development? > (define-public python2-sphinx > (package-with-python2 python-sphinx)) > + > +(define-public cython > + (package > + (name "cython") > + (version "0.21.1") > + (source > + (origin > + (method url-fetch) > + (uri (string-append > + "http://cython.org/release/Cython-" > + version ".tar.gz")) The style in the rest of the file would dictate that the uri begin on the same line as string-append. > + (sha256 > + (base32 > + "0ddz2l2dvcy5hdkxx4xlfiwpccvwia7ixgcy4h0pdv46a4i4vxj3")))) > + (build-system python-build-system) > + (inputs > + `(("python" ,python))) ; otherwise ld doesn't find libpython3.3m.so > + (arguments > + `(#:phases > + (alist-replace > + 'build > + (lambda* (#:key outputs inputs > + #:allow-other-keys #:rest args) > + (let ((build (assoc-ref %standard-phases 'build))) > + (setenv "HOME" "/tmp") ; some tests require access to "$HOME/.cython" > + (apply build args))) If $HOME is only required for tests only, please make the setenv a separate phase that comes just before the check phase. See e.g. duplicity or rdup in gnu/packages/backup.scm, or the definition of python-2 itself. We try to avoid "wrapping" phases with (apply args). > + (alist-replace > + 'check > + (lambda _ (zero? > + (system* "python" > + "runtests.py" > + "-vv"))) Nitpicky: the lambda could probably go on a single line (e.g. python-parse or python-enum34). > + %standard-phases)))) > + (home-page "http://cython.org/") > + (synopsis "C extensions for Python") > + (description "Cython is an optimising static compiler for both the Python > +programming language and the extended Cython programming language. It makes > +writing C extensions for Python as easy as Python itself.") > + (license asl2.0))) > + > +(define-public cython2 > + (package > + (inherit cython) > + (name "cython2") > + (build-system python-build-system) > + (inputs > + `(("python-2" ,python-2))) > + (arguments > + `(#:python ,python-2 ,@(package-arguments cython))))) Does package-with-python2 not work here? You might be able to do:: (define-public cython2 (package (inherit (package-with-python2 cython)) (name "cython2"))) -- Eric Bavier