gnu: scons: Update to 4.4.0.

* gnu/packages/patches/scons-test-environment.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/build-tools.scm (scons): Update to 4.4.0.
[source](patches): New field.
[arguments]: Adjust bootstrap for the new version.  Enable tests.
[native-inputs]: Add PYTHON-WHEEL and PYTHON-PSUTIL.
(scons-3): New variable.
(scons-python2): Inherit from it.
* gnu/packages/web.scm (serf)[arguments]: Stick with SCONS-3 to prevent rebuilds.
This commit is contained in:
Marius Bakke 2022-08-13 18:14:34 +02:00
parent ada35de38f
commit 59bbf7e86c
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA
4 changed files with 128 additions and 13 deletions

View file

@ -1802,6 +1802,7 @@ dist_patch_DATA = \
%D%/packages/patches/sbcl-png-fix-sbcl-compatibility.patch \
%D%/packages/patches/scalapack-gcc-10-compilation.patch \
%D%/packages/patches/scheme48-tests.patch \
%D%/packages/patches/scons-test-environment.patch \
%D%/packages/patches/scotch-build-parallelism.patch \
%D%/packages/patches/scotch-integer-declarations.patch \
%D%/packages/patches/screen-hurd-path-max.patch \

View file

@ -34,6 +34,7 @@ (define-module (gnu packages build-tools)
#: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 @@ (define-module (gnu packages build-tools)
#: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 @@ (define-public premake5
(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 @@ (define-public scons
(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

View file

@ -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

View file

@ -1944,7 +1944,8 @@ (define-public serf
;;("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"))