Summary: | A minor change in new_protect_filename() in portage_util.py | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Ali Polatel (RETIRED) <hawking> |
Component: | Core | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED FIXED | ||
Severity: | trivial | CC: | yogaishrs |
Priority: | High | Keywords: | InVCS |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 147007 |
Description
Ali Polatel (RETIRED)
2006-10-05 06:10:22 UTC
You have not specified why you wanna change portage_util.py so pls explain The calling code should have checked that stuff already. That makes your check redundant and it's annoying to have a bunch of redundant checks in the code. Well basically , the function os.path.isdir() is native and I think it's better to use it instead of 'mydest[-1] == os.path.sep'.Actually this the only place where os.path.sep is used to check for a directory afaik.All other functions use os.path.isdir() About the other change , 'not mydest' is faster than the len() call.To be honest, this is usually at microseconds level but why not use the faster? And about what Zac said , I agree that it's annoying to have redundant checks in the code.I didn't have time to check if the calling code do the checks.If so the checks in new_protect_filename() are not needed and should be removed. In svn r4601 I've removed all the the validation of parameters because portage doesn't need it. Please note that os.path.isdir(mydest) results in a stat call, and unnecessary stat calls should be avoided. This has been released in 2.1.2_pre2-r5. |