comparison piecrust/processing/less.py @ 1155:fac4483867a5

less: Fix issues moving the map file on Windows. Again.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 11 Jun 2019 15:11:39 -0700
parents a3dec0fbd9ce
children
comparison
equal deleted inserted replaced
1154:aad9b5a0a809 1155:fac4483867a5
1 import os 1 import os
2 import os.path 2 import os.path
3 import sys 3 import sys
4 import json 4 import json
5 import shutil
5 import hashlib 6 import hashlib
6 import logging 7 import logging
7 import platform 8 import platform
8 import subprocess 9 import subprocess
9 from piecrust.processing.base import ( 10 from piecrust.processing.base import (
90 stderr_data.decode(sys.stderr.encoding)) 91 stderr_data.decode(sys.stderr.encoding))
91 92
92 logger.debug("Moving map file: %s -> %s" % (temp_map_path, map_path)) 93 logger.debug("Moving map file: %s -> %s" % (temp_map_path, map_path))
93 if os.path.exists(map_path): 94 if os.path.exists(map_path):
94 os.remove(map_path) 95 os.remove(map_path)
95 os.rename(temp_map_path, map_path) 96 shutil.move(temp_map_path, map_path)
96 97
97 return True 98 return True
98 99
99 def _ensureInitialized(self): 100 def _ensureInitialized(self):
100 if self._conf is not None: 101 if self._conf is not None: