From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: 'python-build-system' Date: Wed, 08 May 2013 18:47:25 +0200 Message-ID: <87k3n9zaea.fsf@gnu.org> References: <87sj34zvn1.fsf@karetnikov.org> <87ehdwkntv.fsf@gnu.org> <87sj2b8llf.fsf@karetnikov.org> <877gjmr2to.fsf@karetnikov.org> <87ip36gyxz.fsf@gnu.org> <87obcym1vj.fsf@karetnikov.org> <871u9tlfzx.fsf@gnu.org> <87ppx2qlu8.fsf@karetnikov.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ua7Wl-0000PK-4H for bug-guix@gnu.org; Wed, 08 May 2013 12:47:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ua7Wj-0000l4-Pn for bug-guix@gnu.org; Wed, 08 May 2013 12:47:39 -0400 Received: from [2a01:e0b:1:123:ca0a:a9ff:fe03:271e] (port=53438 helo=xanadu.aquilenet.fr) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ua7Wj-0000iI-I6 for bug-guix@gnu.org; Wed, 08 May 2013 12:47:37 -0400 In-Reply-To: <87ppx2qlu8.fsf@karetnikov.org> (Nikita Karetnikov's message of "Wed, 08 May 2013 05:52:47 +0400") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Nikita Karetnikov Cc: bug-guix@gnu.org Nikita Karetnikov skribis: >> If you append (package-native-search-paths python) to the list of search >> paths, then PYTHONPATH will automagically be defined appropriately (see >> .) > >> If you don=E2=80=99t, then PYTHONPATH will be undefined, unless you expl= icitly >> define it in build/python-build-system.scm, which is not the recommended >> option. > >> So just mimic the change made in the above commit for perl-build-system. > > OK, I've added it. Should I remove the following part? > > + (let* ((out (assoc-ref outputs "out")) > + (var `("PYTHONPATH" prefix > + (,(string-append out "/lib/python" > + python-version "/site-packages"))))) > + (for-each (lambda (dir) > + (let ((files (list-of-files dir))) > + (for-each (cut wrap-program <> var) > + files))) > + bindirs))) > > Or is it a different issue? Yes, see below. [...] > +(define* (python-build store name source inputs > + #:key > + (python (@ (gnu packages python) python)) > + (python-version > + (string-take (package-version > + (@ (gnu packages python) python)) = 3)) > + (tests? #t) > + (configure-flags ''()) > + (phases '(@ (guix build python-build-system) > + %standard-phases)) > + (outputs '("out")) > + (search-paths '()) > + (system (%current-system)) > + (guile #f) > + (imported-modules '((guix build python-build-syst= em) > + (guix build gnu-build-system) > + (guix build utils))) > + (modules '((guix build python-build-system) > + (guix build gnu-build-system) > + (guix build utils)))) > + "Build SOURCE using PYTHON, and with INPUTS. This assumes that SOURCE > +provides a 'setup.py' file as its build system." > + (define python-search-paths > + (append (package-native-search-paths python) > + (standard-search-paths))) > + > + (define builder > + `(begin > + (use-modules ,@modules) > + (python-build #:name ,name > + #:source ,(if (and source (derivation-path? source)) > + (derivation-path->output-path source) > + source) > + #:configure-flags ,configure-flags > + #:system ,system > + #:test-target "test" > + #:tests? ,tests? > + #:outputs %outputs > + #:python-version ,python-version > + #:search-paths ',(map search-path-specification->se= xp > + (append python-search-paths > + (standard-search-path= s))) Typo here. Should be: (append python-search-paths search-paths) Otherwise the =E2=80=98search-paths=E2=80=99 argument would not be honored. [...] > +(define* (wrap #:key outputs python-version #:allow-other-keys) > + (define (list-of-files dir) > + (map (cut string-append dir "/" <>) > + (or (scandir dir (lambda (f) > + (let ((s (stat (string-append dir "/" f)))) > + (eq? 'regular (stat:type s))))) > + '()))) > + > + (define bindirs > + (append-map (match-lambda > + ((_ . dir) > + (list (string-append dir "/bin") > + (string-append dir "/sbin")))) > + outputs)) > + > + (let* ((out (assoc-ref outputs "out")) > + (var `("PYTHONPATH" prefix > + (,(string-append out "/lib/python" > + python-version "/site-packages"))))) We also need to account for extra Python modules the package depends on: (let* (... (var `("PYTHONPATH" prefix ,(cons (string-append out "/lib/python" python-version "/site-packages") (search-path-as-string->list (or (getenv "PYTHONPATH") ""))))) ...) To answer your previous question, this =E2=80=98wrap=E2=80=99 phase serves = a different (but related) purpose than the =E2=80=98native-search-paths=E2=80=99 thing:= it ensures that the =E2=80=98bzr=E2=80=99 program, when run by the user, finds all its= Python modules. [...] > +(define-public bazaar > + (package > + (name "bazaar") > + (version "2.5.1") > + (source > + (origin > + (method url-fetch) > + (uri (string-append "https://launchpad.net/bzr/2.5/" version > + "/+download/bzr-" version ".tar.gz")) > + (sha256 > + (base32 > + "10krjbzia2avn09p0cdlbx2wya0r5v11w5ymvyl72af5dkx4cwwn")))) > + (build-system python-build-system) > + (inputs > + ;; FIXME: 'tools/packaging/lp-upload-release' and 'tools/weavemerge= .sh' > + ;; require Zsh. =E2=80=9CNote:=E2=80=9D rather than =E2=80=9CFIXME:=E2=80=9D. > + `(("gettext" ,guix:gettext))) > + (arguments > + `(#:tests? #f)) Could you add a comment stating what=E2=80=99s wrong with the test suite? = Or, if it=E2=80=99s easily doable, just make it pass (if it=E2=80=99s not, it c= an be done later.) With these changes in place, OK to commit. Thanks! Ludo=E2=80=99.