unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/2] gnu: Add python-waf.
@ 2015-04-20  5:52 宋文武
  2015-04-20  5:52 ` [PATCH 2/2] gnu: python-pycairo: Fix build with with python-3.4.3 宋文武
  0 siblings, 1 reply; 6+ messages in thread
From: 宋文武 @ 2015-04-20  5:52 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/python.scm (python-waf, python2-waf): New variables.
---
 gnu/packages/python.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index d64f633..050c0de 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -3508,3 +3508,39 @@ It is written entirely in Python.")
 
 (define-public python2-singledispatch
   (package-with-python2 python-singledispatch))
+
+(define-public python-waf
+  (package
+    (name "python-waf")
+    (version "1.8.8")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://waf.io/"
+                                  "waf-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0b5q307fgn6a5d8yjia2d1l4bk1q3ilvc0w8k4isfrrx2gbcw8wn"))))
+    (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+                  (lambda _
+                    (zero? (begin
+                             (system* "python" "waf-light" "configure")
+                             (system* "python" "waf-light" "build")))))
+         (replace 'check
+                  (lambda _
+                    (zero? (system* "python" "waf" "--version"))))
+         (replace 'install
+                  (lambda _
+                    (copy-file "waf" %output))))))
+    (home-page "https://waf.io/")
+    (synopsis "Python-based build system")
+    (description
+     "Waf is a Python-based framework for configuring, compiling and installing
+applications.")
+    (license bsd-3)))
+
+(define-public python2-waf
+  (package-with-python2 python-waf))
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] gnu: python-pycairo: Fix build with with python-3.4.3.
  2015-04-20  5:52 [PATCH 1/2] gnu: Add python-waf 宋文武
@ 2015-04-20  5:52 ` 宋文武
  2015-04-20  6:32   ` Ricardo Wurmus
  0 siblings, 1 reply; 6+ messages in thread
From: 宋文武 @ 2015-04-20  5:52 UTC (permalink / raw)
  To: guix-devel

* gnu/packages/patches/pycairo-wscript.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/gtk.scm (python-pycairo)[source]: Use it.
  [native-inputs]: Add python-waf.
  [arguments]<#:phases>: Add 'patch-waf phase.
* gnu/packages/gtk.scm (python2-pycairo): Adjust accordingly.
---
 gnu-system.am                              |  1 +
 gnu/packages/gtk.scm                       | 42 +++++++++++++++++++-----------
 gnu/packages/patches/pycairo-wscript.patch | 31 ++++++++++++++++++++++
 3 files changed, 59 insertions(+), 15 deletions(-)
 create mode 100644 gnu/packages/patches/pycairo-wscript.patch

diff --git a/gnu-system.am b/gnu-system.am
index b11706c..723d251 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -514,6 +514,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/procps-make-3.82.patch			\
   gnu/packages/patches/pulseaudio-fix-mult-test.patch		\
   gnu/packages/patches/pulseaudio-longer-test-timeout.patch	\
+  gnu/packages/patches/pycairo-wscript.patch			\
   gnu/packages/patches/pybugz-encode-error.patch		\
   gnu/packages/patches/pybugz-stty.patch			\
   gnu/packages/patches/pyqt-configure.patch			\
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index cd54cfc..ce0bb99 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -30,6 +30,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix build-system waf)
+  #:use-module (gnu packages)
   #:use-module (gnu packages check)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages compression)
@@ -733,29 +734,36 @@ extensive documentation, including API reference and a tutorial.")
                           version ".tar.bz2"))
       (sha256
        (base32
-        "1gjkf8x6hyx1skq3hhwcbvwifxvrf9qxis5vx8x5igmmgs70g94s"))))
+        "1gjkf8x6hyx1skq3hhwcbvwifxvrf9qxis5vx8x5igmmgs70g94s"))
+      (patches (list (search-patch "pycairo-wscript.patch")))))
     (build-system python-build-system)
     (native-inputs
-     `(("pkg-config" ,pkg-config)))
+     `(("pkg-config" ,pkg-config)
+       ("python-waf" ,python-waf)))
     (propagated-inputs                  ;pycairo.pc references cairo
      `(("cairo" ,cairo)))
     (arguments
      `(#:tests? #f
        #:phases (alist-cons-before
-                 'build 'configure
-                 (lambda* (#:key outputs #:allow-other-keys)
-                   (zero? (system* "./waf" "configure"
-                                   (string-append "--prefix="
-                                                  (assoc-ref outputs "out")))))
-                 (alist-replace
-                  'build
-                  (lambda _
-                    (zero? (system* "./waf" "build")))
+                 'configure 'patch-waf
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   ;; The bundled `waf' doesn't work with python-3.4.x.
+                   (copy-file (assoc-ref %build-inputs "python-waf") "./waf"))
+                 (alist-cons-before
+                  'build 'configure
+                  (lambda* (#:key outputs #:allow-other-keys)
+                    (zero? (system* "./waf" "configure"
+                                    (string-append "--prefix="
+                                                   (assoc-ref outputs "out")))))
                   (alist-replace
-                   'install
+                   'build
                    (lambda _
-                     (zero? (system* "./waf" "install")))
-                   %standard-phases)))))
+                     (zero? (system* "./waf" "build")))
+                   (alist-replace
+                    'install
+                    (lambda _
+                      (zero? (system* "./waf" "install")))
+                    %standard-phases))))))
     (home-page "http://cairographics.org/pycairo/")
     (synopsis "Python bindings for cairo")
     (description
@@ -776,7 +784,11 @@ extensive documentation, including API reference and a tutorial.")
         "0cblk919wh6w0pgb45zf48xwxykfif16qk264yga7h9fdkq3j16k"))))
     (arguments
      `(#:python ,python-2
-       ,@(package-arguments python-pycairo)))
+       ,@(substitute-keyword-arguments (package-arguments python-pycairo)
+           ((#:phases phases)
+            `(alist-delete 'patch-waf ,phases))
+           ((#:native-inputs native-inputs)
+            `(alist-delete "python-waf" ,native-inputs)))))
     ;; Dual-licensed under LGPL 2.1 or Mozilla Public License 1.1
     (license (list license:lgpl2.1 license:mpl1.1))))
 
diff --git a/gnu/packages/patches/pycairo-wscript.patch b/gnu/packages/patches/pycairo-wscript.patch
new file mode 100644
index 0000000..c49f0af
--- /dev/null
+++ b/gnu/packages/patches/pycairo-wscript.patch
@@ -0,0 +1,31 @@
+Update the wscript to work with waf-1.8.8.  Based on:
+http://cgit.freedesktop.org/pycairo/commit/?id=c57cd129407c904f8c2f752a59d0183df7b01a5e
+
+
+--- pycairo-1.10.0.orig/wscript	2011-04-18 15:42:29.000000000 +0800
++++ pycairo-1.10.0/wscript	2015-04-20 13:01:45.383756898 +0800
+@@ -13,18 +13,18 @@
+ 
+ def options(ctx):
+   print('  %s/options()' %d)
+-  ctx.tool_options('gnu_dirs')
+-  ctx.tool_options('compiler_cc')
+-  ctx.tool_options('python') # options for disabling pyc or pyo compilation
++  ctx.load('gnu_dirs')
++  ctx.load('compiler_c')
++  ctx.load('python') # options for disabling pyc or pyo compilation
+ 
+ 
+ def configure(ctx):
+   print('  %s/configure()' %d)
+ 
+   env = ctx.env
+-  ctx.check_tool('gnu_dirs')
+-  ctx.check_tool('compiler_cc')
+-  ctx.check_tool('python')
++  ctx.load('gnu_dirs')
++  ctx.load('compiler_c')
++  ctx.load('python')
+   ctx.check_python_version((3,1,0))
+   ctx.check_python_headers()
+   ctx.check_cfg(package='cairo', atleast_version=cairo_version_required,
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] gnu: python-pycairo: Fix build with with python-3.4.3.
  2015-04-20  5:52 ` [PATCH 2/2] gnu: python-pycairo: Fix build with with python-3.4.3 宋文武
@ 2015-04-20  6:32   ` Ricardo Wurmus
  2015-04-20  6:51     ` 宋文武
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2015-04-20  6:32 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel


宋文武 writes:
> +                 (alist-cons-before
> +                  'build 'configure
> +                  (lambda* (#:key outputs #:allow-other-keys)
> +                    (zero? (system* "./waf" "configure"
> +                                    (string-append "--prefix="
> +                                                   (assoc-ref outputs "out")))))
>                    (alist-replace
> -                   'install
> +                   'build
>                     (lambda _
> -                     (zero? (system* "./waf" "install")))
> -                   %standard-phases)))))
> +                     (zero? (system* "./waf" "build")))
> +                   (alist-replace
> +                    'install
> +                    (lambda _
> +                      (zero? (system* "./waf" "install")))
> +                    %standard-phases))))))

I wonder if it would make sense to just use the waf-build-system in this
case instead of the python-build-system.  Is this feasible?

~~ Ricardo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] gnu: python-pycairo: Fix build with with python-3.4.3.
  2015-04-20  6:32   ` Ricardo Wurmus
@ 2015-04-20  6:51     ` 宋文武
  2015-04-23 19:10       ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: 宋文武 @ 2015-04-20  6:51 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

Ricardo Wurmus <rekado@elephly.net> writes:

> 宋文武 writes:
>> +                 (alist-cons-before
>> +                  'build 'configure
>> +                  (lambda* (#:key outputs #:allow-other-keys)
>> +                    (zero? (system* "./waf" "configure"
>> +                                    (string-append "--prefix="
>> +                                                   (assoc-ref outputs "out")))))
>>                    (alist-replace
>> -                   'install
>> +                   'build
>>                     (lambda _
>> -                     (zero? (system* "./waf" "install")))
>> -                   %standard-phases)))))
>> +                     (zero? (system* "./waf" "build")))
>> +                   (alist-replace
>> +                    'install
>> +                    (lambda _
>> +                      (zero? (system* "./waf" "install")))
>> +                    %standard-phases))))))
>
> I wonder if it would make sense to just use the waf-build-system in this
> case instead of the python-build-system.  Is this feasible?
Yes! Thanks for the tip.
Here are the new patch using waf-build-system:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-python-pycairo-Fix-build-with-with-python-3.4.3.patch --]
[-- Type: text/x-patch, Size: 5585 bytes --]

From 9a83f762e5f5479a9efedefc6fea9c37a49bb87e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
Date: Mon, 20 Apr 2015 13:45:43 +0800
Subject: [PATCH] gnu: python-pycairo: Fix build with with python-3.4.3.

* gnu/packages/patches/pycairo-wscript.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/gtk.scm (python-pycairo)[source]: Use it.
  [build-system]: Use waf-build-system.
  [native-inputs]: Add python-waf.
  [arguments]<#:phases>: Use 'modify-phases'.  Add 'patch-waf phase.
* gnu/packages/gtk.scm (python2-pycairo): Adjust accordingly.
---
 gnu-system.am                              |  1 +
 gnu/packages/gtk.scm                       | 37 +++++++++++++++---------------
 gnu/packages/patches/pycairo-wscript.patch | 31 +++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 19 deletions(-)
 create mode 100644 gnu/packages/patches/pycairo-wscript.patch

diff --git a/gnu-system.am b/gnu-system.am
index b11706c..723d251 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -514,6 +514,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/procps-make-3.82.patch			\
   gnu/packages/patches/pulseaudio-fix-mult-test.patch		\
   gnu/packages/patches/pulseaudio-longer-test-timeout.patch	\
+  gnu/packages/patches/pycairo-wscript.patch			\
   gnu/packages/patches/pybugz-encode-error.patch		\
   gnu/packages/patches/pybugz-stty.patch			\
   gnu/packages/patches/pyqt-configure.patch			\
diff --git a/gnu/packages/gtk.scm b/gnu/packages/gtk.scm
index cd54cfc..67838a3 100644
--- a/gnu/packages/gtk.scm
+++ b/gnu/packages/gtk.scm
@@ -30,6 +30,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python)
   #:use-module (guix build-system waf)
+  #:use-module (gnu packages)
   #:use-module (gnu packages check)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages compression)
@@ -733,29 +734,23 @@ extensive documentation, including API reference and a tutorial.")
                           version ".tar.bz2"))
       (sha256
        (base32
-        "1gjkf8x6hyx1skq3hhwcbvwifxvrf9qxis5vx8x5igmmgs70g94s"))))
-    (build-system python-build-system)
+        "1gjkf8x6hyx1skq3hhwcbvwifxvrf9qxis5vx8x5igmmgs70g94s"))
+      (patches (list (search-patch "pycairo-wscript.patch")))))
+    (build-system waf-build-system)
     (native-inputs
-     `(("pkg-config" ,pkg-config)))
+     `(("pkg-config" ,pkg-config)
+       ("python-waf" ,python-waf)))
     (propagated-inputs                  ;pycairo.pc references cairo
      `(("cairo" ,cairo)))
     (arguments
      `(#:tests? #f
-       #:phases (alist-cons-before
-                 'build 'configure
-                 (lambda* (#:key outputs #:allow-other-keys)
-                   (zero? (system* "./waf" "configure"
-                                   (string-append "--prefix="
-                                                  (assoc-ref outputs "out")))))
-                 (alist-replace
-                  'build
-                  (lambda _
-                    (zero? (system* "./waf" "build")))
-                  (alist-replace
-                   'install
-                   (lambda _
-                     (zero? (system* "./waf" "install")))
-                   %standard-phases)))))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before
+          'configure 'patch-waf
+          (lambda* (#:key inputs #:allow-other-keys)
+            ;; The bundled `waf' doesn't work with python-3.4.x.
+            (copy-file (assoc-ref %build-inputs "python-waf") "./waf"))))))
     (home-page "http://cairographics.org/pycairo/")
     (synopsis "Python bindings for cairo")
     (description
@@ -776,7 +771,11 @@ extensive documentation, including API reference and a tutorial.")
         "0cblk919wh6w0pgb45zf48xwxykfif16qk264yga7h9fdkq3j16k"))))
     (arguments
      `(#:python ,python-2
-       ,@(package-arguments python-pycairo)))
+       ,@(substitute-keyword-arguments (package-arguments python-pycairo)
+           ((#:phases phases)
+            `(alist-delete 'patch-waf ,phases))
+           ((#:native-inputs native-inputs)
+            `(alist-delete "python-waf" ,native-inputs)))))
     ;; Dual-licensed under LGPL 2.1 or Mozilla Public License 1.1
     (license (list license:lgpl2.1 license:mpl1.1))))
 
diff --git a/gnu/packages/patches/pycairo-wscript.patch b/gnu/packages/patches/pycairo-wscript.patch
new file mode 100644
index 0000000..c49f0af
--- /dev/null
+++ b/gnu/packages/patches/pycairo-wscript.patch
@@ -0,0 +1,31 @@
+Update the wscript to work with waf-1.8.8.  Based on:
+http://cgit.freedesktop.org/pycairo/commit/?id=c57cd129407c904f8c2f752a59d0183df7b01a5e
+
+
+--- pycairo-1.10.0.orig/wscript	2011-04-18 15:42:29.000000000 +0800
++++ pycairo-1.10.0/wscript	2015-04-20 13:01:45.383756898 +0800
+@@ -13,18 +13,18 @@
+ 
+ def options(ctx):
+   print('  %s/options()' %d)
+-  ctx.tool_options('gnu_dirs')
+-  ctx.tool_options('compiler_cc')
+-  ctx.tool_options('python') # options for disabling pyc or pyo compilation
++  ctx.load('gnu_dirs')
++  ctx.load('compiler_c')
++  ctx.load('python') # options for disabling pyc or pyo compilation
+ 
+ 
+ def configure(ctx):
+   print('  %s/configure()' %d)
+ 
+   env = ctx.env
+-  ctx.check_tool('gnu_dirs')
+-  ctx.check_tool('compiler_cc')
+-  ctx.check_tool('python')
++  ctx.load('gnu_dirs')
++  ctx.load('compiler_c')
++  ctx.load('python')
+   ctx.check_python_version((3,1,0))
+   ctx.check_python_headers()
+   ctx.check_cfg(package='cairo', atleast_version=cairo_version_required,
-- 
2.2.1


[-- Attachment #3: Type: text/plain, Size: 15 bytes --]

>
> ~~ Ricardo

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] gnu: python-pycairo: Fix build with with python-3.4.3.
  2015-04-20  6:51     ` 宋文武
@ 2015-04-23 19:10       ` Ludovic Courtès
  2015-04-24  8:29         ` Ricardo Wurmus
  0 siblings, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2015-04-23 19:10 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

宋文武 <iyzsong@gmail.com> skribis:

> From 9a83f762e5f5479a9efedefc6fea9c37a49bb87e Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
> Date: Mon, 20 Apr 2015 13:45:43 +0800
> Subject: [PATCH] gnu: python-pycairo: Fix build with with python-3.4.3.
>
> * gnu/packages/patches/pycairo-wscript.patch: New file.
> * gnu-system.am (dist_patch_DATA): Add it.
> * gnu/packages/gtk.scm (python-pycairo)[source]: Use it.
>   [build-system]: Use waf-build-system.
>   [native-inputs]: Add python-waf.
>   [arguments]<#:phases>: Use 'modify-phases'.  Add 'patch-waf phase.
> * gnu/packages/gtk.scm (python2-pycairo): Adjust accordingly.

Ricardo certainly knows this better, but it LGTM.

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] gnu: python-pycairo: Fix build with with python-3.4.3.
  2015-04-23 19:10       ` Ludovic Courtès
@ 2015-04-24  8:29         ` Ricardo Wurmus
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Wurmus @ 2015-04-24  8:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel


Ludovic Courtès writes:

> 宋文武 <iyzsong@gmail.com> skribis:
>
>> From 9a83f762e5f5479a9efedefc6fea9c37a49bb87e Mon Sep 17 00:00:00 2001
>> From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= <iyzsong@gmail.com>
>> Date: Mon, 20 Apr 2015 13:45:43 +0800
>> Subject: [PATCH] gnu: python-pycairo: Fix build with with python-3.4.3.
>>
>> * gnu/packages/patches/pycairo-wscript.patch: New file.
>> * gnu-system.am (dist_patch_DATA): Add it.
>> * gnu/packages/gtk.scm (python-pycairo)[source]: Use it.
>>   [build-system]: Use waf-build-system.
>>   [native-inputs]: Add python-waf.
>>   [arguments]<#:phases>: Use 'modify-phases'.  Add 'patch-waf phase.
>> * gnu/packages/gtk.scm (python2-pycairo): Adjust accordingly.
>
> Ricardo certainly knows this better, but it LGTM.

Also looks good to me.
Thanks!

~~ Ricardo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-24  8:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-20  5:52 [PATCH 1/2] gnu: Add python-waf 宋文武
2015-04-20  5:52 ` [PATCH 2/2] gnu: python-pycairo: Fix build with with python-3.4.3 宋文武
2015-04-20  6:32   ` Ricardo Wurmus
2015-04-20  6:51     ` 宋文武
2015-04-23 19:10       ` Ludovic Courtès
2015-04-24  8:29         ` Ricardo Wurmus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).