Fix after previous commit

This commit is contained in:
oobabooga 2025-01-27 10:02:21 -08:00
parent 053911b629
commit 340022d4b0

View File

@ -359,20 +359,17 @@ def update_requirements(initial_installation=False, pull=True):
# Load state from JSON file # Load state from JSON file
state_file = '.installer_state.json' state_file = '.installer_state.json'
current_commit = get_current_commit()
wheels_changed = False wheels_changed = False
if os.path.exists(state_file): if os.path.exists(state_file):
with open(state_file, 'r') as f: with open(state_file, 'r') as f:
last_state = json.load(f) last_state = json.load(f)
wheels_changed = last_state.get('wheels_changed', False) if 'wheels_changed' in last_state or last_state.get('last_commit') != current_commit:
wheels_changed = True
else: else:
last_state = {} last_state = {}
# Check wheels changed from state file and commit differences
current_commit = get_current_commit()
if last_state.get('last_commit') != current_commit:
wheels_changed = True
if pull: if pull:
# Read .whl lines before pulling # Read .whl lines before pulling
before_pull_whl_lines = [] before_pull_whl_lines = []
@ -407,10 +404,9 @@ def update_requirements(initial_installation=False, pull=True):
wheels_changed = True wheels_changed = True
# Save state before exiting # Save state before exiting
current_state = { current_state = {'last_commit': current_commit}
'last_commit': current_commit, if wheels_changed:
'wheels_changed': wheels_changed current_state['wheels_changed'] = True
}
with open(state_file, 'w') as f: with open(state_file, 'w') as f:
json.dump(current_state, f) json.dump(current_state, f)
@ -420,10 +416,9 @@ def update_requirements(initial_installation=False, pull=True):
wheels_changed = wheels_changed or (before_pull_whl_lines != after_pull_whl_lines) wheels_changed = wheels_changed or (before_pull_whl_lines != after_pull_whl_lines)
# Save current state # Save current state
current_state = { current_state = {'last_commit': current_commit}
'last_commit': current_commit, if wheels_changed:
'wheels_changed': wheels_changed current_state['wheels_changed'] = True
}
with open(state_file, 'w') as f: with open(state_file, 'w') as f:
json.dump(current_state, f) json.dump(current_state, f)