14
14
15
15
# Define constant paths for clarity
16
16
PORTABLE_DIRECTORY = Path (__file__ ).parent / "portable"
17
-
18
- # Ensure necessary directories exist at the start
19
17
assert PORTABLE_DIRECTORY .is_dir (), f"Portable directory not found: { PORTABLE_DIRECTORY } "
20
18
21
19
def copy_items (source_directories : list [Path ], target_directory : Path , verbose : bool = False ):
@@ -46,7 +44,7 @@ class WinPythonDistributionBuilder:
46
44
47
45
def __init__ (self , build_number : int , release_level : str , target_directory : Path , wheels_directory : Path ,
48
46
tools_directories : list [Path ] = None , verbose : bool = False ,
49
- install_options : list [ str ] = None , flavor : str = "" ):
47
+ flavor : str = "" ):
50
48
"""
51
49
Initializes the WinPythonDistributionBuilder.
52
50
Args:
@@ -56,7 +54,6 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
56
54
wheels_directory: Directory containing wheel files for packages.
57
55
tools_directories: List of directories containing development tools to include.
58
56
verbose: Enable verbose output.
59
- install_options: Additional pip install options.
60
57
flavor: WinPython flavor (e.g., "Barebone").
61
58
"""
62
59
self .build_number = build_number
@@ -67,7 +64,6 @@ def __init__(self, build_number: int, release_level: str, target_directory: Path
67
64
self .verbose = verbose
68
65
self .winpython_directory : Path | None = None
69
66
self .distribution : wppm .Distribution | None = None
70
- self .install_options = install_options or []
71
67
self .flavor = flavor
72
68
self .python_zip_file : Path = self ._get_python_zip_file ()
73
69
self .python_name = self .python_zip_file .stem
@@ -141,12 +137,10 @@ def _create_initial_batch_scripts(self):
141
137
def build (self , winpy_dir : Path = None ):
142
138
"""Make or finalise WinPython distribution in the target directory"""
143
139
print (f"Building WinPython with Python archive: { self .python_zip_file .name } " )
144
- if winpy_dir is None :
145
- raise RuntimeError ("WinPython base directory to create is undefined" )
146
140
self .winpython_directory = winpy_dir
147
141
148
142
self ._print_action (f"Creating WinPython { self .winpython_directory } base directory" )
149
- if self .winpython_directory .is_dir ():
143
+ if self .winpython_directory .is_dir () and len ( self . winpython_directory . parts ) >= 4 :
150
144
shutil .rmtree (self .winpython_directory )
151
145
os .makedirs (self .winpython_directory , exist_ok = True )
152
146
# preventive re-Creation of settings directory
@@ -157,18 +151,10 @@ def build(self, winpy_dir: Path = None):
157
151
158
152
self ._copy_essential_files ()
159
153
self ._create_initial_batch_scripts ()
160
- utils .python_execmodule ("ensurepip" , self .distribution .target )
161
- self .distribution .patch_standard_packages ("pip" )
162
- essential_packages = ["pip" , "setuptools" , "wheel" , "wppm" ]
163
- for package_name in essential_packages :
164
- actions = ["install" , "--upgrade" , "--pre" , package_name ] + self .install_options
165
- self ._print_action (f"Piping: { ' ' .join (actions )} " )
166
- self .distribution .do_pip_action (actions )
167
- self .distribution .patch_standard_packages (package_name )
168
154
169
155
def make_all (build_number : int , release_level : str , basedir_wpy : Path = None ,
170
- verbose : bool = False , install_options = [ "--no-index" ],
171
- flavor : str = "" , find_links : str | list [ Path ] = None ,
156
+ verbose : bool = False ,
157
+ flavor : str = "" ,
172
158
source_dirs : Path = None , toolsdirs : str | list [Path ] = None ,
173
159
):
174
160
"""
@@ -178,18 +164,13 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
178
164
release_level: release level (e.g. 'beta1', '') [str]
179
165
basedir_wpy: top directory of the build (c:\...\Wpy...)
180
166
verbose: Enable verbose output (bool).
181
- install_options: pip options (r'--no-index --pre --trusted-host=None')
182
167
flavor: WinPython flavor (str).
183
- find_links: package directories (r'D:\Winpython\packages.srcreq')
184
- source_dirs: the python.zip + rebuilt winpython wheel package directory
168
+ source_dirs: the python.zip
185
169
toolsdirs: Directory with development tools r'D:\WinPython\b asedir34\t .Slim'
186
170
"""
187
171
assert basedir_wpy is not None , "The *winpython_dirname* directory must be specified"
188
172
189
173
tools_dirs_list = parse_list_argument (toolsdirs , "," )
190
- install_options_list = parse_list_argument (install_options , " " )
191
- find_links_dirs_list = parse_list_argument (find_links , "," )
192
- find_links_options = [f"--find-links={ link } " for link in find_links_dirs_list + [source_dirs ]]
193
174
winpy_dir = Path (basedir_wpy )
194
175
195
176
utils .print_box (f"Making WinPython at { winpy_dir } " )
@@ -198,7 +179,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
198
179
build_number , release_level , winpy_dir .parent , wheels_directory = source_dirs ,
199
180
tools_directories = [Path (d ) for d in tools_dirs_list ],
200
181
verbose = verbose ,
201
- install_options = install_options_list + find_links_options ,
202
182
flavor = flavor
203
183
)
204
184
builder .build (winpy_dir = winpy_dir )
@@ -212,8 +192,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
212
192
basedir_wpy = r"D:\WinPython\bd314\budot\WPy64-31401b3" ,
213
193
verbose = True ,
214
194
flavor = "dot" ,
215
- install_options = r"--no-index --pre --trusted-host=None" ,
216
- find_links = r"D:\Winpython\packages.srcreq" ,
217
195
source_dirs = r"D:\WinPython\bd314\packages.win-amd64" ,
218
196
toolsdirs = r"D:\WinPython\bd314\t.Slim" ,
219
197
)
0 commit comments