3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-08-09 06:41:26 +00:00

-f clean: QoL improvement on Windows concerning file/dir removal locking

When using the -f argument be more forgiving with the expectation of a clean
workspace and the expectation of the new sby run being responsible for
directory creation.

This is a usability and quality of life improvement for Windows users where
the OS can implement file and directory locking implicitly.  In the EDA world
it is common to have multiple tools in use at any one time and it can become
tortious to have to close files / exit 3rd party applications to release
locking so sby is happy to rerun.

This change will prevent sby claiming a terminal error has occurred when it
fails to create a directory that already exists.  It also now considers the
environment to be 'clean' (as per -f) if all the non-directory elements of
the file tree have been deleted, leaving potentially an empty a skeleton of
directories.
This commit is contained in:
Darryl L. Miles 2023-02-18 08:51:23 +00:00 committed by Darryl Miles
parent 37d1234e38
commit fa5bc957c1
2 changed files with 16 additions and 4 deletions

View file

@ -920,10 +920,11 @@ class SbyTask(SbyConfig):
def makedirs(self, path):
if self.reusedir and os.path.isdir(path):
rmtree(path, ignore_errors=True)
os.makedirs(path)
if not os.path.isdir(path):
os.makedirs(path)
def copy_src(self):
os.makedirs(self.workdir + "/src")
self.makedirs(self.workdir + "/src")
for dstfile, lines in self.verbatim_files.items():
dstfile = self.workdir + "/src/" + dstfile