[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/103: gnu: Properly bootstrap python-flit-core and python-tomli.
From: |
guix-commits |
Subject: |
03/103: gnu: Properly bootstrap python-flit-core and python-tomli. |
Date: |
Wed, 5 Jan 2022 09:44:27 -0500 (EST) |
lbraun pushed a commit to branch wip-python-pep517
in repository guix.
commit 9051c8d913925d29329f75e62626480a7f1f6701
Author: Lars-Dominik Braun <lars@6xq.net>
AuthorDate: Sat Dec 4 08:54:49 2021 +0100
gnu: Properly bootstrap python-flit-core and python-tomli.
There is a circular dependency between the two, but we can break it by
copying files to the right places in a bootstrap version.
* gnu/packages/python-build.scm (python-tomli)[arguments]: Remove obsolete
custom build phases, disable tests.
[native-inputs]: Use python-flit-core-bootstrap.
(python-tomli-bootstrap): New variable.
(python-flit-core-bootstrap): New variable.
(python-flit-core): Inherit from -bootstrap.
---
gnu/packages/python-build.scm | 95 ++++++++++++++++++++++---------------------
1 file changed, 49 insertions(+), 46 deletions(-)
diff --git a/gnu/packages/python-build.scm b/gnu/packages/python-build.scm
index 1a35738f95..89cc40016d 100644
--- a/gnu/packages/python-build.scm
+++ b/gnu/packages/python-build.scm
@@ -25,7 +25,9 @@
(define-module (gnu packages python-build)
#:use-module (gnu packages)
#:use-module ((guix licenses) #:prefix license:)
+ #:use-module (guix utils)
#:use-module (guix build-system python)
+ #:use-module (guix build-system copy)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix packages)
@@ -236,25 +238,9 @@ Python file, so it can be easily copied into your
project.")
(base32 "1vjg44narb7hdiazdmbv8bfv7pi6phnq7nxm6aphx0iqxcah1kn6"))))
(build-system python-build-system)
(arguments
- `(#:tests? #f ;disabled to avoid extra dependencies
- #:phases
- (modify-phases %standard-phases
- (replace 'build
- (lambda _
- (setenv "PYTHONPATH" (string-append (getcwd) ":"
- (getenv "GUIX_PYTHONPATH")))
- (invoke "python" "-m" "build" "--wheel" "--no-isolation"
- "--skip-dependency-check")))
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (whl (car (find-files "dist" "\\.whl$"))))
- (invoke "pip" "--no-cache-dir" "--no-input"
- "install" "--no-deps" "--prefix" out whl)))))))
+ `(#:tests? #f)) ;disabled to avoid extra dependencies
(native-inputs
- `(("python-flit-core" ,python-flit-core)
- ("python-pypa-build" ,python-pypa-build)
- ("python-six", python-six-bootstrap)))
+ `(("python-flit-core" ,python-flit-core-bootstrap)))
(home-page "https://github.com/hukkin/tomli")
(synopsis "Small and fast TOML parser")
(description "Tomli is a minimal TOML parser that is fully compatible with
@@ -262,6 +248,19 @@ Python file, so it can be easily copied into your
project.")
@code{python-toml}.")
(license license:expat)))
+;; Bootstrap variant, which does not depend on python-build-system at
+;; all. This breaks the cycle between flit-core and tomli.
+(define-public python-tomli-bootstrap
+ (package
+ (inherit python-tomli)
+ (name "python-tomli-bootstrap")
+ (build-system copy-build-system)
+ (native-inputs '()) ; Remove native-inputs from python-tomli.
+ (arguments
+ '(#:install-plan
+ ;; XXX: Do not hard-code Python version.
+ '(("tomli" "lib/python3.9/site-packages/tomli"))))))
+
(define-public python-pep517-bootstrap
(hidden-package
(package
@@ -425,43 +424,47 @@ a light weight, fully compliant, self-contained package
allowing PEP 517
compatible build front-ends to build Poetry managed projects.")
(license license:expat)))
-(define-public python-flit-core
+;; Be aware that python-flit inherits from python-flit-core and must be
+;; updated too, if you change anything here.
+(define-public python-flit-core-bootstrap
(package
- (name "python-flit-core")
+ (name "python-flit-core-bootstrap")
(version "3.4.0")
- (source
- (origin
- (method url-fetch)
- (uri (pypi-uri "flit" version))
- (sha256
- (base32 "10vjqnybvjdqdbmyc0asbhhvq51yjnnj00645yiq9849gnr8h0ir"))))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/pypa/flit.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1nsiksar883bz8kjcz5ap7jax3pz2ysmq9p79ggavq8imp5vxapl"))))
(build-system python-build-system)
(propagated-inputs
- (list python-toml))
+ (list python-tomli-bootstrap))
(arguments
- ;; flit-core has a test suite, but it requires Pytest. Disable it so
- ;; as to not pull pytest as an input.
`(#:tests? #f
+ #:build-backend "flit_core.build_thyself"
#:phases
(modify-phases %standard-phases
- (replace 'build
- ;; flit-core requires itself to build. Luckily, a
- ;; bootstrapping script exists, which does so using just
- ;; the checkout sources and Python.
+ ;; python-tomli-bootstrap is not installed with metadata and triggers
the sanity check.
+ (delete 'sanity-check)
+ (add-after 'unpack 'chdir
(lambda _
- (invoke "python" "flit_core/build_dists.py")))
- (replace 'install
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (whl (car (find-files "." "\\.whl$"))))
- (invoke "pip" "--no-cache-dir" "--no-input"
- "install" "--no-deps" "--prefix" out whl))))
- ;; The sanity-check phase fails because flit depends on tomli at
- ;; run-time, but this core variant avoids it to avoid a cycle.
- (delete 'sanity-check))))
- (home-page "https://github.com/takluyver/flit")
- (synopsis "Core package of the Flit Python build system")
- (description "This package provides @code{flit-core}, a PEP 517 build
+ (chdir "flit_core"))))))
+ (home-page "https://flit.readthedocs.io/")
+ (synopsis
+ "Core package of the Flit Python build system")
+ (description
+ "This package provides @code{flit-core}, a PEP 517 build
backend for packages using Flit. The only public interface is the API
specified by PEP 517, @code{flit_core.buildapi}.")
(license license:bsd-3)))
+
+(define-public python-flit-core
+ (package
+ (inherit python-flit-core-bootstrap)
+ (name "python-flit-core")
+ (propagated-inputs
+ `(("python-tomli" ,python-tomli)))))
+
- branch wip-python-pep517 created (now 4968ef975c), guix-commits, 2022/01/05
- 03/103: gnu: Properly bootstrap python-flit-core and python-tomli.,
guix-commits <=
- 01/103: build/python: Handle missing setuptools in sanity-check.py, guix-commits, 2022/01/05
- 04/103: gnu: python-pep517-bootstrap: Update to 0.12.0., guix-commits, 2022/01/05
- 05/103: gnu: python-pypa-build: Replace toml with tomli., guix-commits, 2022/01/05
- 08/103: gnu: pypy: Move to separate module., guix-commits, 2022/01/05
- 14/103: gnu: python-testpath: Remove custom build phases., guix-commits, 2022/01/05
- 11/103: gnu: python-pyzmq: Fix #:configure-flags type., guix-commits, 2022/01/05
- 12/103: gnu: python-file: Remove obsolete #:configure-flags., guix-commits, 2022/01/05
- 09/103: gnu: python-charset-normalizer: Add missing input., guix-commits, 2022/01/05
- 13/103: gnu: python-mediafile: Add missing build dependencies., guix-commits, 2022/01/05
- 17/103: gnu: gusb-minimal: Add explicit dependency on setuptools., guix-commits, 2022/01/05