Exclude other files contained in the user_docs folder#16047
Merged
seanbudd merged 5 commits intonvaccess:betafrom Jan 19, 2024
Merged
Exclude other files contained in the user_docs folder#16047seanbudd merged 5 commits intonvaccess:betafrom
seanbudd merged 5 commits intonvaccess:betafrom
Conversation
seanbudd
reviewed
Jan 15, 2024
Comment on lines
+261
to
+269
| + getRecursiveDataFiles( | ||
| "documentation", "../user_docs", | ||
| excludes=( | ||
| "*.t2t", "*.t2tconf", "*.md", | ||
| "*.py", "__pycache__", | ||
| "*/user_docs/styles.css", | ||
| "*/developerGuide.*" | ||
| ) | ||
| ) |
Member
There was a problem hiding this comment.
Please put each item on a new line.
It appears styles.css is not being specified correctly - there is no user_docs folder in user_docs. Can you confirm you tested this? Are you sure styles.css should not be included?
Suggested change
| + getRecursiveDataFiles( | |
| "documentation", "../user_docs", | |
| excludes=( | |
| "*.t2t", "*.t2tconf", "*.md", | |
| "*.py", "__pycache__", | |
| "*/user_docs/styles.css", | |
| "*/developerGuide.*" | |
| ) | |
| ) | |
| + getRecursiveDataFiles( | |
| "documentation", | |
| "../user_docs", | |
| excludes=( | |
| "*.t2t", | |
| "*.t2tconf", | |
| "*.md", | |
| "*.py", | |
| "__pycache__", | |
| "styles.css", | |
| "*/developerGuide.*" | |
| ) | |
| ) | |
Contributor
Author
There was a problem hiding this comment.
Regarding user_docs/styles.css, it seems to match like this:
>>> import fnmatch
>>> print(fnmatch.fnmatch("../user_docs/styles.css", "user_docs/styles.css"))
False
>>> print(fnmatch.fnmatch("../user_docs/styles.css", "*/user_docs/styles.css"))
TrueBy the way, the getRecursiveDataFiles function is a bit too unintuitive.
def getRecursiveDataFiles(dest, source, excludes=()):
rulesList = []
for f in glob("%s/*" % source):
if (
not any(fnmatch.fnmatch(f, exclude) for exclude in excludes)
and os.path.isfile(f)
):
rulesList.append((
dest,
[f]))
for dirName in os.listdir(source):
if os.path.isdir(os.path.join(source, dirName)) and not dirName.startswith('.'):
rulesList.extend(
getRecursiveDataFiles(
os.path.join(dest, dirName),
os.path.join(source, dirName),
excludes=excludes
)
)
return rulesListBut this is not exactly equivalent to the previous list comprehensions, because even if the files are all excluded, there will still be a tuple with an empty list in rulesList.
See test results for failed build of commit 4d2fc7b979 |
seanbudd
previously approved these changes
Jan 19, 2024
Adriani90
pushed a commit
to Adriani90/nvda
that referenced
this pull request
Mar 13, 2024
Related nvaccess#15945, nvaccess#16024 Summary of the issue: The documentation folder in the NVDA directory contains files that the user does not need. For example: keyCommandsDoc.py Description of user facing changes The structure of the subfolders in documentation is the same as in the release version, with documentation/styles.css removed. Description of development approach In setup.py, exclude the corresponding file
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Related #15945, #16024
Summary of the issue:
The
documentationfolder in the NVDA directory contains files that the user does not need.For example:
keyCommandsDoc.pyDescription of user facing changes
The structure of the subfolders in documentation is the same as in the release version, with
documentation/styles.cssremoved.Description of development approach
In
setup.py, exclude the corresponding fileTesting strategy:
Install a build of NVDA or create a portable version.
View the contents of the documentation folder.
Known issues with pull request:
Unable to exclude
documentation/__pycache__empty folderPerhaps we could consider overriding the
getRecursiveDataFilesfunction.Without using list comprehensions.
Code Review Checklist: