-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directories are not copied in export() function #663
Comments
Actually, I suppose giving two directories to cmp would return false: dirs = list(set(map(os.path.dirname, src_files)))
for d in dirs:
os.makedirs(os.path.join(dst_dir, d), exist_ok=True) |
There might very well be a bug, but I would like to get a better understanding of what you're trying to do. Can you describe your use-case? For some context, I'm philosophically against copying directories as that will break dependency tracking that we use to avoid unnecessary rebuilds (in the Flow API). But IIRC there was someone with a need to use |
We have an existing method to build documentation from a potentially large The tool that builds documentation from the directory of source files doesn't actually accept a list of source files. It accepts a directory name and basically crawls every file in the directory. We currently do this outside FuseSoC file discovery/manipulation. While I can provide the directory name in a core file; I'm finding that the directory contents in the build area are all missing, though the tree of all directories is recreated (just with every file missing). We actually don't currently use FuseSoC's fileset for this (and this bug is filed because when I tried to do so, I found that it didn't work with directories). It's also possible that we aren't using export() and some other piece of our code is failing to copy over directory contents, so it could be unrelated. One possibility is that while FuseSoC's code above attempts to support directories in the export() function, in the rest of FuseSoC functionality like making lists of files in filelists it does not crawl the directory and expand into a list of contained files; it might just report the name of the directory. It's unclear to me why the directory tree is recreated but none of the contents. Ideally, I should be able to make a filelist with a directory as the contents, and I would assume based on the code above that this would be supported (even though filesets:
documentation_files:
files:
- doc
file_type: directory |
I see your use case. I'm not saying no right away, but I think we would need to carefully analyze this, as it has severe impact on some fundamental design choices. I do wonder if adding a copyto directive would sort things out for your particular case, since that demonstrably already works with directories. The difference is that your directory would end up directly under the work directory instead of the source directory, but perhaps that's not an issue? |
I found that only directories (empty, with none of the expected contents) are copied, due to what I think is a bug in
capi2/core.py
:fusesoc/fusesoc/capi2/core.py
Line 121 in 584d0ae
From lines 108 to 125 you have the following, so I assume you intend to support directories (since you handle the case that it is a directory and fall back to
copytree()
).However,
filecmp.cmp()
is not the right function to use for comparing directories. You would need to detect whether it is a file or directory and instead you should probably usefilecmp.dircmp()
if a directory. Or, you could skip the comparison entirely and just copy it over!See here: https://docs.python.org/3/library/filecmp.html
The text was updated successfully, but these errors were encountered: