Visitar URL original
Fix: Mac/Extras.install.py,Can not filter osx .DS_store file by zhangbo2012 · Pull Request #98579 · python/cpython · GitHub
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update OSX DS_store File Name
  • Loading branch information
zhangbo
zhangbo committed Oct 24, 2022
commit 9d8aa3587ec00412d69d1653f8175f4ecbcebf5e
1 change: 1 addition & 0 deletions Mac/Extras.install.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def isclean(name):
if name == 'CVS': return 0
if name == '.cvsignore': return 0
if name == '.DS_store': return 0
if name == '.DS_Store': return 0
if name == '.svn': return 0
Comment on lines 12 to 16

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.

Suggested change
if name == 'CVS': return 0
if name == '.cvsignore': return 0
if name == '.DS_store': return 0
if name == '.DS_Store': return 0
if name == '.svn': return 0
if name in ('CVS', '.cvsignore', '.DS_store', '.DS_Store', '.svn')`:
return 0

A proof-of-concept:

>>> def test(name):
...    return name in ('CVS', '.cvsignore', '.DS_store', '.DS_Store', '.svn')
...
>>> test('fooCVS')
False
>>> test('foo')
False
>>> test('CVS')
True

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

simple and better performance

if name.endswith('~'): return 0
if name.endswith('.BAK'): return 0
Expand Down