-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug in update-state - need to switch to the fixture dir first
- Loading branch information
1 parent
c8582c5
commit fcbe936
Showing
2 changed files
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,28 @@ | ||
import os | ||
|
||
from ..state import MepoState | ||
from ..component import MepoComponent | ||
|
||
def run(args): | ||
'''Permanently convert mepo1 state to mepo2 state''' | ||
allcomps_old = MepoState.read_state() | ||
MepoState.mepo1_patch_undo() | ||
# Convert component to dict and then package it as component again. That is | ||
# needed to avoid pickle trying to use the path to the old modules | ||
allcomps = [] | ||
for comp in allcomps_old: | ||
# print(comp) | ||
tmp_dict = comp.to_registry_format() | ||
name = list(tmp_dict)[0] | ||
comp = tmp_dict[name] | ||
allcomps.append(MepoComponent().to_component(name, comp, None)) | ||
tmp_name = list(tmp_dict)[0] | ||
tmp_details = tmp_dict[tmp_name] | ||
# This needs to be run from the fixture directory so that | ||
# MepoComponent::__set_original_version | ||
# picks the right repo for setting version | ||
cwd = os.getcwd() | ||
os.chdir(MepoState.get_root_dir()) | ||
comp_new = MepoComponent().to_component(tmp_name, tmp_details, None) | ||
os.chdir(cwd) | ||
allcomps.append(comp_new) | ||
# Write new state | ||
MepoState.write_state(allcomps) | ||
print('\nConverted mepo1 state to mepo2\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters