Skip to content

Commit

Permalink
Change move to copy build dir during an upgrade (#1429)
Browse files Browse the repository at this point in the history
* Change move to copy build dir during an upgrade
* Got rid of unused backup_temp_dir
  • Loading branch information
rafzei authored Jul 9, 2020
1 parent 35c1f5e commit 8b01341
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions core/src/epicli/cli/engine/UpgradeEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,9 @@ def backup_build(self):

# no backup dir so use the latest
backup_dir_name = f'backup_{int(round(time.time() * 1000))}'
backup_temp_dir = os.path.join(self.build_dir, '../', backup_dir_name)
self.backup_build_dir = os.path.join(self.build_dir, backup_dir_name )
self.logger.info(f'Backing up old build files to "{self.backup_build_dir}"')
shutil.move(self.build_dir, backup_temp_dir, copy_function = shutil.copytree)
if not os.path.exists(self.build_dir):
os.mkdir(self.build_dir)
shutil.move(backup_temp_dir, self.backup_build_dir, copy_function = shutil.copytree)
self.logger.info(f'Backing up build dir to "{self.backup_build_dir}"')
shutil.copytree(self.build_dir, self.backup_build_dir)

def upgrade(self):
# backup existing build
Expand Down

0 comments on commit 8b01341

Please sign in to comment.