summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2025-06-19 09:58:51 +0200
committerSharlatan Hellseher <sharlatanus@gmail.com>2025-09-25 09:35:34 +0100
commit977caf32ef4fbb08f56e412d1394e946cd96776e (patch)
treee7ea887f57f6001925069efeb7c5ec51038d9690
parent9a40c5145d6b4db3cb28b6814ca6bf0a560fa41a (diff)
build-system/pyproject: Avoid PEP427 substitution on binary files.
In some rare cases, the dest-path can be an elf-file, which are unreadable by substitute*, leading to an error instead of just continuing which makes more sense in this case. * guix/build-system/pyproject.scm (check): Guard substitution attempt with basic readability guarantees. Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
-rw-r--r--guix/build/pyproject-build-system.scm9
1 files changed, 5 insertions, 4 deletions
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index 1fa610faa98..1ca91701c3d 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -218,10 +218,11 @@ builder.build_wheel(sys.argv[3], config_settings=config_settings)"
(lambda (file)
(chmod file #o755)
;; PEP 427 recommends that installers rewrite
- ;; this odd shebang.
- (substitute* file
- (("#!python")
- (string-append "#!" python "/bin/python"))))
+ ;; this odd shebang, but avoid the binary case.
+ (unless (elf-file? file)
+ (substitute* file
+ (("#!python")
+ (string-append "#!" python "/bin/python")))))
(find-files destination))))
;; Data can be contained in arbitrary directory structures. Most
;; commonly it is used for share/.