@@ -29,52 +29,54 @@ def prepare_distribution_metadata(self, finder, build_isolation):
29
29
30
30
self .req .load_pyproject_toml ()
31
31
should_isolate = self .req .use_pep517 and build_isolation
32
+ if should_isolate :
33
+ self ._setup_isolation (finder )
32
34
35
+ self .req .prepare_metadata ()
36
+ self .req .assert_source_matches_version ()
37
+
38
+ def _setup_isolation (self , finder ):
33
39
def _raise_conflicts (conflicting_with , conflicting_reqs ):
34
40
raise InstallationError (
35
41
"Some build dependencies for %s conflict with %s: %s." % (
36
42
self .req , conflicting_with , ', ' .join (
37
43
'%s is incompatible with %s' % (installed , wanted )
38
44
for installed , wanted in sorted (conflicting ))))
39
45
40
- if should_isolate :
41
- # Isolate in a BuildEnvironment and install the build-time
42
- # requirements.
43
- self .req .build_env = BuildEnvironment ()
44
- self .req .build_env .install_requirements (
45
- finder , self .req .pyproject_requires , 'overlay' ,
46
- "Installing build dependencies"
46
+ # Isolate in a BuildEnvironment and install the build-time
47
+ # requirements.
48
+ self .req .build_env = BuildEnvironment ()
49
+ self .req .build_env .install_requirements (
50
+ finder , self .req .pyproject_requires , 'overlay' ,
51
+ "Installing build dependencies"
52
+ )
53
+ conflicting , missing = self .req .build_env .check_requirements (
54
+ self .req .requirements_to_check
55
+ )
56
+ if conflicting :
57
+ _raise_conflicts ("PEP 517/518 supported requirements" ,
58
+ conflicting )
59
+ if missing :
60
+ logger .warning (
61
+ "Missing build requirements in pyproject.toml for %s." ,
62
+ self .req ,
47
63
)
48
- conflicting , missing = self .req .build_env .check_requirements (
49
- self .req .requirements_to_check
64
+ logger .warning (
65
+ "The project does not specify a build backend, and "
66
+ "pip cannot fall back to setuptools without %s." ,
67
+ " and " .join (map (repr , sorted (missing )))
50
68
)
51
- if conflicting :
52
- _raise_conflicts ("PEP 517/518 supported requirements" ,
53
- conflicting )
54
- if missing :
55
- logger .warning (
56
- "Missing build requirements in pyproject.toml for %s." ,
57
- self .req ,
58
- )
59
- logger .warning (
60
- "The project does not specify a build backend, and "
61
- "pip cannot fall back to setuptools without %s." ,
62
- " and " .join (map (repr , sorted (missing )))
63
- )
64
- # Install any extra build dependencies that the backend requests.
65
- # This must be done in a second pass, as the pyproject.toml
66
- # dependencies must be installed before we can call the backend.
67
- with self .req .build_env :
68
- # We need to have the env active when calling the hook.
69
- self .req .spin_message = "Getting requirements to build wheel"
70
- reqs = self .req .pep517_backend .get_requires_for_build_wheel ()
71
- conflicting , missing = self .req .build_env .check_requirements (reqs )
72
- if conflicting :
73
- _raise_conflicts ("the backend dependencies" , conflicting )
74
- self .req .build_env .install_requirements (
75
- finder , missing , 'normal' ,
76
- "Installing backend dependencies"
77
- )
78
-
79
- self .req .prepare_metadata ()
80
- self .req .assert_source_matches_version ()
69
+ # Install any extra build dependencies that the backend requests.
70
+ # This must be done in a second pass, as the pyproject.toml
71
+ # dependencies must be installed before we can call the backend.
72
+ with self .req .build_env :
73
+ # We need to have the env active when calling the hook.
74
+ self .req .spin_message = "Getting requirements to build wheel"
75
+ reqs = self .req .pep517_backend .get_requires_for_build_wheel ()
76
+ conflicting , missing = self .req .build_env .check_requirements (reqs )
77
+ if conflicting :
78
+ _raise_conflicts ("the backend dependencies" , conflicting )
79
+ self .req .build_env .install_requirements (
80
+ finder , missing , 'normal' ,
81
+ "Installing backend dependencies"
82
+ )
0 commit comments