Skip to content

Exclude other files contained in the user_docs folder#16047

Merged
seanbudd merged 5 commits intonvaccess:betafrom
hwf1324:excludesUserDocsOtherFile
Jan 19, 2024
Merged

Exclude other files contained in the user_docs folder#16047
seanbudd merged 5 commits intonvaccess:betafrom
hwf1324:excludesUserDocsOtherFile

Conversation

@hwf1324
Copy link
Copy Markdown
Contributor

@hwf1324 hwf1324 commented Jan 15, 2024

Link to issue number:

Related #15945, #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

Testing 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 folder

Perhaps we could consider overriding the getRecursiveDataFiles function.
Without using list comprehensions.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@hwf1324 hwf1324 requested a review from a team as a code owner January 15, 2024 16:15
@hwf1324 hwf1324 requested review from seanbudd and removed request for a team January 15, 2024 16:15
Comment on lines +261 to +269
+ getRecursiveDataFiles(
"documentation", "../user_docs",
excludes=(
"*.t2t", "*.t2tconf", "*.md",
"*.py", "__pycache__",
"*/user_docs/styles.css",
"*/developerGuide.*"
)
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.*"
)
)

Copy link
Copy Markdown
Contributor Author

@hwf1324 hwf1324 Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"))
True

By 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 rulesList

But 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.

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Jan 15, 2024
@AppVeyorBot
Copy link
Copy Markdown

See test results for failed build of commit 4d2fc7b979

seanbudd
seanbudd previously approved these changes Jan 19, 2024
Copy link
Copy Markdown
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hwf1324

@seanbudd seanbudd merged commit fea112a into nvaccess:beta Jan 19, 2024
@nvaccessAuto nvaccessAuto added this to the 2024.2 milestone Jan 19, 2024
@hwf1324 hwf1324 deleted the excludesUserDocsOtherFile branch January 19, 2024 04:31
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants