14
14
15
15
# Define constant paths for clarity
16
16
PORTABLE_DIRECTORY = Path (__file__ ).parent / "portable"
17
- NODEJS_RELATIVE_PATH = "n" # Relative path within WinPython dir
18
17
19
18
# Ensure necessary directories exist at the start
20
19
assert PORTABLE_DIRECTORY .is_dir (), f"Portable directory not found: { PORTABLE_DIRECTORY } "
@@ -81,17 +80,6 @@ def _get_python_zip_file(self) -> Path:
81
80
return source_item
82
81
raise RuntimeError (f"Could not find Python zip package in { self .wheels_directory } " )
83
82
84
- @property
85
- def package_index_markdown (self ) -> str :
86
- """Generates a Markdown formatted package index page."""
87
- return self .distribution .generate_package_index_markdown (
88
- self .python_executable_directory ,
89
- self .winpyver2 ,
90
- self .flavor ,
91
- self .architecture_bits ,
92
- self .release_level
93
- )
94
-
95
83
@property
96
84
def winpython_version_name (self ) -> str :
97
85
"""Returns the full WinPython version string."""
@@ -150,38 +138,36 @@ def _create_initial_batch_scripts(self):
150
138
with open (self .winpython_directory / "scripts" / "env.ini" , "w" ) as f :
151
139
f .writelines ([f'{ a } ={ b } \n ' for a , b in init_variables ])
152
140
153
- def build (self , rebuild : bool = True , winpy_dir : Path = None ):
141
+ def build (self , winpy_dir : Path = None ):
154
142
"""Make or finalise WinPython distribution in the target directory"""
155
143
print (f"Building WinPython with Python archive: { self .python_zip_file .name } " )
156
144
if winpy_dir is None :
157
145
raise RuntimeError ("WinPython base directory to create is undefined" )
158
146
self .winpython_directory = winpy_dir
159
147
160
- if rebuild :
161
- self ._print_action (f"Creating WinPython { self .winpython_directory } base directory" )
162
- if self .winpython_directory .is_dir ():
163
- shutil .rmtree (self .winpython_directory )
164
- os .makedirs (self
8000
.winpython_directory , exist_ok = True )
165
- # preventive re-Creation of settings directory
166
- (self .winpython_directory / "settings" / "AppData" / "Roaming" ).mkdir (parents = True , exist_ok = True )
167
- self ._extract_python_archive ()
148
+ self ._print_action (f"Creating WinPython { self .winpython_directory } base directory" )
149
+ if self .winpython_directory .is_dir ():
150
+ shutil .rmtree (self .winpython_directory )
151
+ os .makedirs (self .winpython_directory , exist_ok = True )
152
+ # preventive re-Creation of settings directory
153
+ (self .winpython_directory / "settings" / "AppData" / "Roaming" ).mkdir (parents = True , exist_ok = True )
154
+ self ._extract_python_archive ()
168
155
169
156
self .distribution = wppm .Distribution (self .python_executable_directory , verbose = self .verbose )
170
157
171
- if rebuild :
172
- self ._copy_essential_files ()
173
- self ._create_initial_batch_scripts ()
174
- utils .python_execmodule ("ensurepip" , self .distribution .target )
175
- self .distribution .patch_standard_packages ("pip" )
176
- essential_packages = ["pip" , "setuptools" , "wheel" , "wppm" ]
177
- for package_name in essential_packages :
178
- actions = ["install" , "--upgrade
8000
" , "--pre" , package_name ] + self .install_options
179
- self ._print_action (f"Piping: { ' ' .join (actions )} " )
180
- self .distribution .do_pip_action (actions )
181
- self .distribution .patch_standard_packages (package_name )
158
+ self ._copy_essential_files ()
159
+ 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 )
182
168
183
169
def make_all (build_number : int , release_level : str , basedir_wpy : Path = None ,
184
- verbose : bool = False , rebuild : bool = True , install_options = ["--no-index" ],
170
+ verbose : bool = False , install_options = ["--no-index" ],
185
171
flavor : str = "" , find_links : str | list [Path ] = None ,
186
172
source_dirs : Path = None , toolsdirs : str | list [Path ] = None ,
187
173
):
@@ -192,7 +178,6 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
192
178
release_level: release level (e.g. 'beta1', '') [str]
193
179
basedir_wpy: top directory of the build (c:\...\Wpy...)
194
180
verbose: Enable verbose output (bool).
195
- rebuild: Whether to rebuild the distribution (bool).
196
181
install_options: pip options (r'--no-index --pre --trusted-host=None')
197
182
flavor: WinPython flavor (str).
198
183
find_links: package directories (r'D:\Winpython\packages.srcreq')
@@ -207,18 +192,16 @@ def make_all(build_number: int, release_level: str, basedir_wpy: Path = None,
207
192
find_links_options = [f"--find-links={ link } " for link in find_links_dirs_list + [source_dirs ]]
208
193
winpy_dir = Path (basedir_wpy )
209
194
210
- if rebuild :
211
- utils .print_box (f"Making WinPython at { winpy_dir } " )
212
- os .makedirs (winpy_dir , exist_ok = True )
213
-
195
+ utils .print_box (f"Making WinPython at { winpy_dir } " )
196
+ os .makedirs (winpy_dir , exist_ok = True )
214
197
builder = WinPythonDistributionBuilder (
215
198
build_number , release_level , winpy_dir .parent , wheels_directory = source_dirs ,
216
199
tools_directories = [Path (d ) for d in tools_dirs_list ],
217
200
verbose = verbose ,
218
201
install_options = install_options_list + find_links_options ,
219
202
flavor = flavor
220
203
)
221
- builder .build (rebuild = rebuild , winpy_dir = winpy_dir )
204
+ builder .build (winpy_dir = winpy_dir )
222
205
223
206
224
207
if __name__ == "__main__" :
0 commit comments