Skip to content

Fix: Mac/Extras.install.py,Can not filter osx .DS_store file - #98579

Closed
zhangbo2012 wants to merge 1 commit into
python:mainfrom
zhangbo2012:B_MAC.Extras.install.py
Closed

zhangbo2012 wants to merge 1 commit into
python:mainfrom
zhangbo2012:B_MAC.Extras.install.py

Conversation

@zhangbo2012

Copy link
Copy Markdown
Contributor

Mac/Extras.install.py,Can not filter osx DS_store file

As

if name == '.DS_store': return 0

But in OSX, Real File Name is .DS_Store, like this

(venv) zhangbo@zhangbodeMacBook-Pro a2 % ll -a
total 16
drwxr-xr-x  4 zhangbo  staff   128 Oct 22 17:34 .
drwxr-xr-x  8 zhangbo  staff   256 Oct 22 17:18 ..
-rw-r--r--@ 1 zhangbo  staff  6148 Oct 22 17:17 .DS_Store
drwxr-xr-x  3 zhangbo  staff    96 Oct 22 17:23 123

So we need update .DS_store to .DS_Store

@zhangbo2012
zhangbo2012 requested a review from a team as a code owner October 24, 2022 00:38
@bedevere-bot

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@ghost

ghost commented Oct 24, 2022

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:
CLA not signed

Comment thread Mac/Extras.install.py
Comment on lines 12 to 16
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

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

@zhangbo2012
zhangbo2012 deleted the B_MAC.Extras.install.py branch October 24, 2022 01:30
@zhangbo2012

Copy link
Copy Markdown
Contributor Author

Sorry , I use a wrong email, cannot sign Contributor License Agreement @arhadthedev

I'll create a new PR

@arhadthedev

Copy link
Copy Markdown
Member

For history: the new PR is gh-98580.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants