8
8
import shutil
9
9
import stat
10
10
import subprocess
11
- import sys
12
11
import tempfile
13
12
import zipfile
14
13
43
42
class WheelBuilder (Builder ):
44
43
format = "wheel"
45
44
46
- def __init__ (self , poetry , target_dir = None , original = None ):
47
- super (WheelBuilder , self ).__init__ (poetry )
45
+ def __init__ (self , poetry , target_dir = None , original = None , executable = None ):
46
+ super (WheelBuilder , self ).__init__ (poetry , executable = executable )
48
47
49
48
self ._records = []
50
49
self ._original_path = self ._path
@@ -53,16 +52,18 @@ def __init__(self, poetry, target_dir=None, original=None):
53
52
self ._original_path = original .file .parent
54
53
55
54
@classmethod
56
- def make_in (cls , poetry , directory = None , original = None ):
57
- wb = WheelBuilder (poetry , target_dir = directory , original = original )
55
+ def make_in (cls , poetry , directory = None , original = None , executable = None ):
56
+ wb = WheelBuilder (
57
+ poetry , target_dir = directory , original = original , executable = executable
58
+ )
58
59
wb .build ()
59
60
60
61
return wb .wheel_filename
61
62
62
63
@classmethod
63
- def make (cls , poetry ):
64
+ def make (cls , poetry , executable = None ):
64
65
"""Build a wheel in the dist/ directory, and optionally upload it."""
65
- cls .make_in (poetry )
66
+ cls .make_in (poetry , executable = executable )
66
67
67
68
def build (self ):
68
69
logger .info ("Building wheel" )
@@ -146,12 +147,18 @@ def _build(self, wheel):
146
147
147
148
def _run_build_command (self , setup ):
148
149
subprocess .check_call (
149
- [sys .executable , str (setup ), "build" , "-b" , str (self ._path / "build" )]
150
+ [
151
+ self .executable .as_posix (),
152
+ str (setup ),
153
+ "build" ,
154
+ "-b" ,
155
+ str (self ._path / "build" ),
156
+ ]
150
157
)
151
158
152
159
def _run_build_script (self , build_script ):
153
160
logger .debug ("Executing build script: {}" .format (build_script ))
154
- subprocess .check_call ([sys .executable , build_script ])
161
+ subprocess .check_call ([self .executable . as_posix () , build_script ])
155
162
156
163
def _copy_module (self , wheel ): # type: (zipfile.ZipFile) -> None
157
164
to_add = self .find_files_to_add ()
0 commit comments