Refactor function safecopy().
* Change ignore_ptns from [] to (). A mutable default value isn't
as expected when invoke in the second time.
>>> def safecopy(ignore_ptns=[]):
... ignore_ptns += ['*.pyc']
... print ignore_ptns
...
>>> safecopy()
['*.pyc']
>>> safecopy()
['*.pyc', '*.pyc']
* Add a list into ignore_ptns rather than a string
>>> l = []
>>> l += os.path.basename('/usr/bin')
>>> l
['b', 'i', 'n']
* Include all exception classes by (), otherwise it will catch
OSError and assign this exception instance to a local variable
named IOError.
* Move shutil.ignore_patterns() out of try block since it can
never throw OSError nor IOError.
* Remove useless try/except/raise block which catches every
error but reraise it. It's the same as without this try block.
Change-Id: I8837169bbf4acbadf4a2cfd8ac999d371831d86a