summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/build-tools.scm80
-rw-r--r--gnu/packages/patches/scons-test-environment.patch57
-rw-r--r--gnu/packages/web.scm3
3 files changed, 127 insertions, 13 deletions
diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 45f3ec559a..5c9d5409cb 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -34,6 +34,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix utils)
   #:use-module (guix packages)
+  #:use-module (guix gexp)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
@@ -53,6 +54,7 @@
   #:use-module (gnu packages pretty-print)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
@@ -387,17 +389,79 @@ other lower-level build files.")))
 (define-public scons
   (package
     (name "scons")
+    (version "4.4.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/SCons/scons")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (patches (search-patches "scons-test-environment.patch"))
+              (sha256
+               (base32
+                "1czswx1fj2j48rspkrvarkr43k0vii9rsmz054c9yby1dq362fgr"))))
+    (build-system python-build-system)
+    (arguments
+     (list
+      #:modules (append %python-build-system-modules
+                        '((ice-9 ftw) (srfi srfi-26)))
+      #:phases
+      #~(modify-phases (@ (guix build python-build-system) %standard-phases)
+          (add-after 'unpack 'adjust-hard-coded-paths
+            (lambda _
+              (substitute* "SCons/Script/Main.py"
+                (("/usr/share/scons")
+                 (string-append #$output "/share/scons")))))
+          (add-before 'build 'bootstrap
+            (lambda _
+              ;; XXX: Otherwise setup.py bdist_wheel fails.
+              (setenv "PYTHONPATH" (getenv "GUIX_PYTHONPATH"))
+              (invoke "python" "scripts/scons.py")))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "python" "runtest.py" "--all" "--unit-only"))))
+          (add-after 'install 'move-manuals
+            (lambda _
+              ;; XXX: For some reason manuals get installed to the top-level
+              ;; #$output directory.
+              (with-directory-excursion #$output
+                (let ((man1 (string-append #$output "/share/man/man1"))
+                      (stray-manuals (scandir "."
+                                              (cut string-suffix? ".1" <>))))
+                  (mkdir-p man1)
+                  (for-each (lambda (manual)
+                              (link manual (string-append man1 "/" manual))
+                              (delete-file manual))
+                            stray-manuals))))))))
+    (native-inputs
+     ;; TODO: Add 'fop' when available in Guix to generate manuals.
+     (list python-wheel
+           ;;For tests.
+           python-psutil))
+    (home-page "https://scons.org/")
+    (synopsis "Software construction tool written in Python")
+    (description
+     "SCons is a software construction tool.  Think of SCons as an improved,
+cross-platform substitute for the classic Make utility with integrated
+functionality similar to autoconf/automake and compiler caches such as ccache.
+In short, SCons is an easier, more reliable and faster way to build
+software.")
+    (license license:x11)))
+
+(define-public scons-3
+  (package
+    (inherit scons)
     (version "3.0.4")
     (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/SCons/scons")
                    (commit version)))
-             (file-name (git-file-name name version))
+             (file-name (git-file-name "scons" version))
              (sha256
               (base32
                "1xy8jrwz87y589ihcld4hv7wn122sjbz914xn8h50ww77wbhk8hn"))))
-    (build-system python-build-system)
     (arguments
      `(#:use-setuptools? #f                ; still relies on distutils
        #:tests? #f                         ; no 'python setup.py test' command
@@ -414,19 +478,11 @@ other lower-level build files.")))
              (invoke "python" "bootstrap.py" "build/scons" "DEVELOPER=guix")
              (chdir "build/scons")
              #t)))))
-    (home-page "https://scons.org/")
-    (synopsis "Software construction tool written in Python")
-    (description
-     "SCons is a software construction tool.  Think of SCons as an improved,
-cross-platform substitute for the classic Make utility with integrated
-functionality similar to autoconf/automake and compiler caches such as ccache.
-In short, SCons is an easier, more reliable and faster way to build
-software.")
-    (license license:x11)))
+    (native-inputs '())))
 
 (define-public scons-python2
   (package
-    (inherit (package-with-python2 scons))
+    (inherit (package-with-python2 scons-3))
     (name "scons-python2")))
 
 (define-public tup
diff --git a/gnu/packages/patches/scons-test-environment.patch b/gnu/packages/patches/scons-test-environment.patch
new file mode 100644
index 0000000000..be5b61b2d4
--- /dev/null
+++ b/gnu/packages/patches/scons-test-environment.patch
@@ -0,0 +1,57 @@
+Inherit essential environment variables in tests.
+
+Note: it could be better to generalize this in SCons/Platform/posix.py
+instead of just patching the tests.
+
+diff --git a/SCons/ActionTests.py b/SCons/ActionTests.py
+--- a/SCons/ActionTests.py
++++ b/SCons/ActionTests.py
+@@ -98,6 +98,7 @@ outfile2 = test.workpath('outfile2')
+ pipe_file = test.workpath('pipe.out')
+ 
+ scons_env = SCons.Environment.Environment()
++scons_env['ENV']['PATH'] += os.environ['PATH']
+ 
+ # Capture all the stuff the Actions will print,
+ # so it doesn't clutter the output.
+@@ -1090,6 +1091,8 @@ class CommandActionTestCase(unittest.TestCase):
+         except AttributeError:
+             env = Environment()
+ 
++        env = Environment(ENV={'PATH': os.environ['PATH']})
++
+         cmd1 = r'%s %s %s xyzzy' % (_python_, act_py, outfile)
+ 
+         act = SCons.Action.CommandAction(cmd1)
+@@ -1884,7 +1887,7 @@ class ListActionTestCase(unittest.TestCase):
+                     f.write("class2b\n")
+ 
+         act = SCons.Action.ListAction([cmd2, function2, class2a(), class2b])
+-        r = act([], [], Environment(out=outfile))
++        r = act([], [], Environment(out=outfile, ENV={'PATH' : os.getenv('PATH')}))
+         assert isinstance(r.status, class2b), r.status
+         c = test.read(outfile, 'r')
+         assert c == "act.py: 'syzygy'\nfunction2\nclass2a\nclass2b\n", c
+@@ -1948,7 +1951,7 @@ class LazyActionTestCase(unittest.TestCase):
+         a([], [], env=Environment(BAR=f, s=self))
+         assert self.test == 1, self.test
+         cmd = r'%s %s %s lazy' % (_python_, act_py, outfile)
+-        a([], [], env=Environment(BAR=cmd, s=self))
++        a([], [], env=Environment(BAR=cmd, s=self, ENV={'PATH' : os.getenv('PATH')}))
+         c = test.read(outfile, 'r')
+         assert c == "act.py: 'lazy'\n", c
+ 
+diff --git a/SCons/SConfTests.py b/SCons/SConfTests.py
+--- a/SCons/SConfTests.py
++++ b/SCons/SConfTests.py
+@@ -71,7 +71,9 @@ class SConfTestCase(unittest.TestCase):
+         # and we need a new environment, cause references may point to
+         # old modules (well, at least this is safe ...)
+         self.scons_env = self.Environment.Environment()
+-        self.scons_env.AppendENVPath('PATH', os.environ['PATH'])
++        # Inherit the OS environment to get essential variables.
++        inherited_env = os.environ.copy()
++        self.scons_env['ENV'] = inherited_env
+ 
+         # we want to do some autodetection here
+         # this stuff works with
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index aac6bdd5eb..b687e4e3e7 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -1944,7 +1944,8 @@ from streaming URLs.  It is a command-line wrapper for the libquvi library.")
            ;;("gss" ,gss)
            zlib))
     (arguments
-     `(#:scons-flags (list (string-append "APR=" (assoc-ref %build-inputs "apr"))
+     `(#:scons ,scons-3   ;TODO: remove in the next rebuild cycle
+       #:scons-flags (list (string-append "APR=" (assoc-ref %build-inputs "apr"))
                            (string-append "APU=" (assoc-ref %build-inputs "apr-util"))
                            (string-append "OPENSSL=" (assoc-ref %build-inputs "openssl"))
                            ;; (string-append "GSSAPI=" (assoc-ref %build-inputs "gss"))