8686 blc_wheel_path = wheel_dev_folder / files_filtered [0 ]
8787
8888 def _execute_wheel_download (command ):
89- if blc_offline_install :
90- # in the offline mode, we don't need to call pip
91- return
9289 process = subprocess .Popen (command , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
9390 stdout , stderr = process .communicate ()
9491 output = stdout .decode ()
@@ -166,39 +163,28 @@ def _get_installation_info():
166163 return old_wheel_hash , old_pyluxcore_version
167164
168165 def _clear_wheels ():
169- if blc_offline_install :
170- # in the offline mode, user must manually manage folder content
171- return
172166 files = os .listdir (wheel_dl_folder )
173167 if len (files ) == 0 :
174168 return
175169 for file in files :
176170 os .remove (wheel_dl_folder / file )
177171
178172 def _backup_wheels ():
179- if blc_offline_install :
180- # in the offline mode, user must manually manage folder content
181- return
173+ # Backup any wheels from a previously successful installation
182174 files = os .listdir (wheel_dl_folder )
183175 if len (files ) == 0 :
184176 return
185177 for file in files :
186178 shutil .move (wheel_dl_folder / file , wheel_backup_folder / file )
187179
188180 def _delete_backup_wheels ():
189- if blc_offline_install :
190- # in the offline mode, user must manually manage folder content
191- return
192181 files = os .listdir (wheel_backup_folder )
193182 if len (files ) == 0 :
194183 return
195184 for file in files :
196185 os .remove (wheel_backup_folder / file )
197186
198187 def _restore_backup_wheels ():
199- if blc_offline_install :
200- # in the offline mode, user must manually manage folder content
201- return
202188 files = os .listdir (wheel_backup_folder )
203189 if len (files ) == 0 :
204190 return
@@ -232,27 +218,26 @@ def download_pyluxcore():
232218 # Blender has got its own logic for wheel installation, we'll rely on it
233219
234220 # Step 0: for offline install, check content of install_offline/ folder,
235- # derive pyluxcore_version from content,
236- # and copy files to wheels/ folder
221+ # derive pyluxcore_version from content, copy files to wheels/ folder
222+ # and skip the rest.
237223 if blc_offline_install :
238224 pyluxcore_version = _check_offline_content ()
225+ _clear_wheels ()
239226 _copy_offline_files ()
227+ _update_manifest ()
228+ _save_installation_info (wheel_hash , 'None' )
229+ return 0
240230 else :
241231 pyluxcore_version = PYLUXCORE_VERSION
242232
243- # Step 1: Backup wheels from last successful installation
244- # Note: the function is skipped internally when blc_offline_install is True
245- _backup_wheels ()
246-
247- # Step 2: get installation info for comparison in the following steps
233+ # Step 1: get installation info for comparison in the following steps
248234 old_wheel_hash , old_pyluxcore_version = _get_installation_info ()
249235
250- # Step 3 : If blc_wheel_path is specified, install that
236+ # Step 2 : If blc_wheel_path is specified, install that
251237 if blc_wheel_path :
252238 wheel_hash = base64 .urlsafe_b64encode (hashlib .sha256 (open (blc_wheel_path , 'rb' ).read ()).digest ()).decode ('latin1' ).rstrip ('=' )
253239 if wheel_hash == old_wheel_hash :
254240 print ("[BLC] skipping pyluxcore installation. Custom wheel matching hash already installed." )
255- _restore_backup_wheels ()
256241 return 2
257242 print ('[BLC] Installing local version of pyluxcore' )
258243 command = [
@@ -265,6 +250,7 @@ def download_pyluxcore():
265250 wheel_dl_folder
266251 ]
267252 try :
253+ _backup_wheels ()
268254 _execute_wheel_download (command )
269255 _update_manifest ()
270256 _delete_backup_wheels ()
@@ -275,11 +261,10 @@ def download_pyluxcore():
275261 _restore_backup_wheels ()
276262 return 1
277263
278- # Step 4 : If pyluxcore_version is specified, install that
264+ # Step 3 : If pyluxcore_version is specified, install that
279265 elif pyluxcore_version :
280266 if pyluxcore_version .strip () == old_pyluxcore_version .strip ():
281267 print ("[BLC] skipping pyluxcore installation. Specified version already installed." )
282- _restore_backup_wheels ()
283268 return 2
284269 print ('[BLC] installing pyluxcore version:' , pyluxcore_version )
285270 command = [
@@ -292,6 +277,7 @@ def download_pyluxcore():
292277 wheel_dl_folder
293278 ]
294279 try :
280+ _backup_wheels ()
295281 _execute_wheel_download (command )
296282 _update_manifest ()
297283 _delete_backup_wheels ()
@@ -302,9 +288,8 @@ def download_pyluxcore():
302288 _restore_backup_wheels ()
303289 return 1
304290
305- # Step 5 : Fallback, none of the above specified
291+ # Step 4 : Fallback, none of the above specified
306292 print ("[BLC] ERROR: neither blc_wheel_path nor PYLUXCORE_VERSION specified in function download_pyluxcore()!" )
307- _restore_backup_wheels ()
308293 return 1
309294
310295 # We'll invoke download_pyluxcore at each init
0 commit comments