* [bug#74582] [PATCH python-team 0/4] Fix edge case in pyproject-build-system
@ 2024-11-28 8:05 Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 1/4] build/pyproject: Really merge directories in install phase Maxim Cournoyer
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2024-11-28 8:05 UTC (permalink / raw)
To: 74582
Cc: Maxim Cournoyer, Lars-Dominik Braun, Marius Bakke,
Munyoki Kilyungi, Sharlatan Hellseher, Tanguy Le Carrour, jgart
Maxim Cournoyer (4):
build/pyproject: Really merge directories in install phase.
build/pyproject: Fix indentation.
build/pyproject: Update PEP 427 reference URL in comment.
build/pyproject: Resolve import warning.
guix/build/pyproject-build-system.scm | 52 +++++++++++++++------------
1 file changed, 29 insertions(+), 23 deletions(-)
base-commit: dd4b96e72c8fda4b025a75b47212e06e381e9ea1
--
2.46.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#74582] [PATCH python-team 1/4] build/pyproject: Really merge directories in install phase.
2024-11-28 8:05 [bug#74582] [PATCH python-team 0/4] Fix edge case in pyproject-build-system Maxim Cournoyer
@ 2024-11-28 12:16 ` Maxim Cournoyer
2024-11-29 7:23 ` Lars-Dominik Braun
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 2/4] build/pyproject: Fix indentation Maxim Cournoyer
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Maxim Cournoyer @ 2024-11-28 12:16 UTC (permalink / raw)
To: 74582
Cc: Maxim Cournoyer, Maxim Cournoyer, Lars-Dominik Braun,
Marius Bakke, Munyoki Kilyungi, Sharlatan Hellseher,
Tanguy Le Carrour, jgart
Using rename-file, the destination had to be empty otherwise it would error
out. By using copy-recursively, a directory can be copied onto a pre-existing
directory, really merging them. This problem manifested itself attempting to
build the python-pyre package.
* guix/build/pyproject-build-system.scm (install)
<merge-directories>: Use copy-recursively instead of rename-file.
Change-Id: Iceb8609a86f29b17e5fbe6a9629339d0bc26e11f
---
guix/build/pyproject-build-system.scm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index c69ccc9d64..03992d915f 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -194,8 +194,13 @@ (define* (install #:key inputs outputs #:allow-other-keys)
(format #t "~a/~a -> ~a/~a~%"
source file destination file)
(mkdir-p destination)
- (rename-file (string-append source "/" file)
- (string-append destination "/" file))
+ ;; Use 'copy-recursively' rather than 'rename-file' to guard
+ ;; against the odd case where DESTINATION is a non-empty
+ ;; directory, which may happen when using hybrid Python
+ ;; build systems.
+ (copy-recursively (string-append source "/" file)
+ (string-append destination "/" file))
+ (delete-file-recursively (string-append source "/" file))
(when post-move
(post-move file)))
(scandir source
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#74582] [PATCH python-team 2/4] build/pyproject: Fix indentation.
2024-11-28 8:05 [bug#74582] [PATCH python-team 0/4] Fix edge case in pyproject-build-system Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 1/4] build/pyproject: Really merge directories in install phase Maxim Cournoyer
@ 2024-11-28 12:16 ` Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 3/4] build/pyproject: Update PEP 427 reference URL in comment Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 4/4] build/pyproject: Resolve import warning Maxim Cournoyer
3 siblings, 0 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2024-11-28 12:16 UTC (permalink / raw)
To: 74582
Cc: Maxim Cournoyer, Maxim Cournoyer, Lars-Dominik Braun,
Marius Bakke, Munyoki Kilyungi, Sharlatan Hellseher,
Tanguy Le Carrour, jgart
* guix/build/pyproject-build-system.scm: Re-indent file with Emacs.
Change-Id: I15c89628190b81a71f799e4812c3b6a360f93bcb
---
guix/build/pyproject-build-system.scm | 36 +++++++++++++--------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index 03992d915f..d42577b259 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -77,11 +77,11 @@ (define-condition-type &python-build-error &error python-build-error?)
;; Raised when 'check cannot find a valid test system in the inputs.
(define-condition-type &test-system-not-found &python-build-error
- test-system-not-found?)
+ test-system-not-found?)
;; Raised when multiple wheels are created by 'build.
(define-condition-type &cannot-extract-multiple-wheels &python-build-error
- cannot-extract-multiple-wheels?)
+ cannot-extract-multiple-wheels?)
;; Raised, when no wheel has been built by the build system.
(define-condition-type &no-wheels-built &python-build-error no-wheels-built?)
@@ -93,8 +93,7 @@ (define* (build #:key outputs build-backend configure-flags #:allow-other-keys)
"Look up the build backend in a pyproject.toml file."
(call-with-input-file file
(lambda (in)
- (let loop
- ((line (read-line in 'concat)))
+ (let loop ((line (read-line in 'concat)))
(if (eof-object? line) #f
(let ((m (string-match "build-backend = [\"'](.+)[\"']" line)))
(if m
@@ -122,18 +121,18 @@ (define* (build #:key outputs build-backend configure-flags #:allow-other-keys)
auto-build-backend
"setuptools.build_meta")))
(format #t
- "Using '~a' to build wheels, auto-detected '~a', override '~a'.~%"
- use-build-backend auto-build-backend build-backend)
+ "Using '~a' to build wheels, auto-detected '~a', override '~a'.~%"
+ use-build-backend auto-build-backend build-backend)
(mkdir-p wheel-dir)
;; Call the PEP 517 build function, which drops a .whl into wheel-dir.
(invoke "python" "-c"
- "import sys, importlib, json
+ "import sys, importlib, json
config_settings = json.loads (sys.argv[3])
builder = importlib.import_module(sys.argv[1])
builder.build_wheel(sys.argv[2], config_settings=config_settings)"
- use-build-backend
- wheel-dir
- config-settings)))
+ use-build-backend
+ wheel-dir
+ config-settings)))
(define* (check #:key tests? test-backend test-flags #:allow-other-keys)
"Run the test suite of a given Python package."
@@ -253,19 +252,20 @@ (define* (install #:key inputs outputs #:allow-other-keys)
(scandir wheel-dir
(cut string-suffix? ".whl" <>)))))
(cond
- ((> (length wheels) 1)
- ;; This code does not support multiple wheels yet, because their
- ;; outputs would have to be merged properly.
- (raise (condition (&cannot-extract-multiple-wheels))))
- ((= (length wheels) 0)
- (raise (condition (&no-wheels-built)))))
+ ((> (length wheels) 1)
+ ;; This code does not support multiple wheels yet, because their
+ ;; outputs would have to be merged properly.
+ (raise (condition (&cannot-extract-multiple-wheels))))
+ ((= (length wheels) 0)
+ (raise (condition (&no-wheels-built)))))
(for-each extract wheels))
(let ((datadirs (map (cut string-append site-dir "/" <>)
(list-directories site-dir
(file-name-predicate "\\.data$")))))
(for-each (lambda (directory)
(expand-data-directory directory)
- (rmdir directory)) datadirs))))
+ (rmdir directory))
+ datadirs))))
(define* (compile-bytecode #:key inputs outputs #:allow-other-keys)
"Compile installed byte-code in site-packages."
@@ -341,7 +341,7 @@ (define* (create-entrypoints #:key inputs outputs #:allow-other-keys)
import sys
import ~a as mod
sys.exit (mod.~a ())~%" interpreter module function)))
- (chmod file-path #o755)))
+ (chmod file-path #o755)))
(let* ((site-dir (site-packages inputs outputs))
(out (assoc-ref outputs "out"))
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#74582] [PATCH python-team 3/4] build/pyproject: Update PEP 427 reference URL in comment.
2024-11-28 8:05 [bug#74582] [PATCH python-team 0/4] Fix edge case in pyproject-build-system Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 1/4] build/pyproject: Really merge directories in install phase Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 2/4] build/pyproject: Fix indentation Maxim Cournoyer
@ 2024-11-28 12:16 ` Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 4/4] build/pyproject: Resolve import warning Maxim Cournoyer
3 siblings, 0 replies; 7+ messages in thread
From: Maxim Cournoyer @ 2024-11-28 12:16 UTC (permalink / raw)
To: 74582
Cc: Maxim Cournoyer, Maxim Cournoyer, Lars-Dominik Braun,
Marius Bakke, Munyoki Kilyungi, Sharlatan Hellseher,
Tanguy Le Carrour, jgart
* guix/build/pyproject-build-system.scm (install): Update reference URL.
Change-Id: Icf5dcc7254c33e8e466773ee66a2fd5648d583da
---
guix/build/pyproject-build-system.scm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index d42577b259..314839c30f 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -172,8 +172,9 @@ (define* (check #:key tests? test-backend test-flags #:allow-other-keys)
(format #t "test suite not run~%")))
(define* (install #:key inputs outputs #:allow-other-keys)
- "Install a wheel file according to PEP 427"
- ;; See https://www.python.org/dev/peps/pep-0427/#installing-a-wheel-distribution-1-0-py32-none-any-whl
+ "Install a wheel file according to PEP 427."
+ ;; See <https://packaging.python.org/en/latest/specifications/\
+ ;; binary-distribution-format/#binary-distribution-format>.
(let ((site-dir (site-packages inputs outputs))
(python (assoc-ref inputs "python"))
(out (assoc-ref outputs "out")))
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#74582] [PATCH python-team 4/4] build/pyproject: Resolve import warning.
2024-11-28 8:05 [bug#74582] [PATCH python-team 0/4] Fix edge case in pyproject-build-system Maxim Cournoyer
` (2 preceding siblings ...)
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 3/4] build/pyproject: Update PEP 427 reference URL in comment Maxim Cournoyer
@ 2024-11-28 12:16 ` Maxim Cournoyer
2024-11-28 18:44 ` jgart via Guix-patches via
3 siblings, 1 reply; 7+ messages in thread
From: Maxim Cournoyer @ 2024-11-28 12:16 UTC (permalink / raw)
To: 74582
Cc: Maxim Cournoyer, Maxim Cournoyer, Lars-Dominik Braun,
Marius Bakke, Munyoki Kilyungi, Sharlatan Hellseher,
Tanguy Le Carrour, jgart
* guix/build/pyproject-build-system.scm: Hide the 'delete' symbol from
the imported (guix build utils) module to avoid a naming clash warning.
Change-Id: I7db9500b20c71c89e740c18c089f33c8569c4ffd
---
guix/build/pyproject-build-system.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/guix/build/pyproject-build-system.scm b/guix/build/pyproject-build-system.scm
index 314839c30f..beca4dc8ca 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -19,7 +19,7 @@
(define-module (guix build pyproject-build-system)
#:use-module ((guix build python-build-system) #:prefix python:)
- #:use-module (guix build utils)
+ #:use-module ((guix build utils) #:hide (delete))
#:use-module (guix build json)
#:use-module (ice-9 match)
#:use-module (ice-9 ftw)
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [bug#74582] [PATCH python-team 4/4] build/pyproject: Resolve import warning.
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 4/4] build/pyproject: Resolve import warning Maxim Cournoyer
@ 2024-11-28 18:44 ` jgart via Guix-patches via
0 siblings, 0 replies; 7+ messages in thread
From: jgart via Guix-patches via @ 2024-11-28 18:44 UTC (permalink / raw)
To: Maxim Cournoyer, 74582
Cc: Sharlatan Hellseher, Maxim Cournoyer, Munyoki Kilyungi,
Lars-Dominik Braun, Marius Bakke, Tanguy Le Carrour
[-- Attachment #1: Type: text/plain, Size: 147 bytes --]
Thanks!
Would anyone else like to review this? I won't be able to test and review it for up to a week.
LGTM, otherwise.
all best,
jgart
[-- Attachment #2: Type: text/html, Size: 376 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [bug#74582] [PATCH python-team 1/4] build/pyproject: Really merge directories in install phase.
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 1/4] build/pyproject: Really merge directories in install phase Maxim Cournoyer
@ 2024-11-29 7:23 ` Lars-Dominik Braun
0 siblings, 0 replies; 7+ messages in thread
From: Lars-Dominik Braun @ 2024-11-29 7:23 UTC (permalink / raw)
To: Maxim Cournoyer
Cc: Tanguy Le Carrour, Munyoki Kilyungi, 74582, jgart, Marius Bakke,
Sharlatan Hellseher
Hi,
> + ;; Use 'copy-recursively' rather than 'rename-file' to guard
> + ;; against the odd case where DESTINATION is a non-empty
> + ;; directory, which may happen when using hybrid Python
> + ;; build systems.
> + (copy-recursively (string-append source "/" file)
> + (string-append destination "/" file))
> + (delete-file-recursively (string-append source "/" file))
wouldn’t it be easier to remove this function entirely and move the
shebang-replacement via POST-MOVE into a separate function (perhaps
powered by FIND-FILES instead of SCANDIR)?
I believe with this patch we can also remove &cannot-extract-multiple-wheels
further down, since directories should be merged now, right?
Cheers,
Lars
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-29 7:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-28 8:05 [bug#74582] [PATCH python-team 0/4] Fix edge case in pyproject-build-system Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 1/4] build/pyproject: Really merge directories in install phase Maxim Cournoyer
2024-11-29 7:23 ` Lars-Dominik Braun
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 2/4] build/pyproject: Fix indentation Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 3/4] build/pyproject: Update PEP 427 reference URL in comment Maxim Cournoyer
2024-11-28 12:16 ` [bug#74582] [PATCH python-team 4/4] build/pyproject: Resolve import warning Maxim Cournoyer
2024-11-28 18:44 ` jgart via Guix-patches via
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).