Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: client/utils/fs.py

Issue 2060983006: luci-py/isolateserver.py: Add archive support when downloading. (Closed) Base URL: https://github.com/luci/luci-py.git@master
Patch Set: Tests now pass. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« client/run_isolated.py ('K') | « client/tests/isolateserver_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The LUCI Authors. All rights reserved. 1 # Copyright 2015 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Wraps os, os.path and shutil functions to work around MAX_PATH on Windows.""" 5 """Wraps os, os.path and shutil functions to work around MAX_PATH on Windows."""
6 6
7 import __builtin__ 7 import __builtin__
8 import inspect 8 import inspect
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 97
98 def copy2(src, dst): 98 def copy2(src, dst):
99 return shutil.copy2(extend(src), extend(dst)) 99 return shutil.copy2(extend(src), extend(dst))
100 100
101 101
102 def rmtree(path, *args, **kwargs): 102 def rmtree(path, *args, **kwargs):
103 return shutil.rmtree(extend(path), *args, **kwargs) 103 return shutil.rmtree(extend(path), *args, **kwargs)
104 104
105 105
106 copyfileobj = shutil.copyfileobj
107
106 ## The rest 108 ## The rest
107 109
108 110
109 def _get_lambda(func): 111 def _get_lambda(func):
110 return lambda path, *args, **kwargs: func(extend(path), *args, **kwargs) 112 return lambda path, *args, **kwargs: func(extend(path), *args, **kwargs)
111 113
112 114
113 def _is_path_fn(func): 115 def _is_path_fn(func):
114 return (inspect.getargspec(func)[0] or [None]) == 'path' 116 return (inspect.getargspec(func)[0] or [None]) == 'path'
115 117
(...skipping 11 matching lines...) Expand all
127 for _fn in _os_fns: 129 for _fn in _os_fns:
128 if hasattr(os, _fn): 130 if hasattr(os, _fn):
129 sys.modules[__name__].__dict__.setdefault( 131 sys.modules[__name__].__dict__.setdefault(
130 _fn, _get_lambda(getattr(os, _fn))) 132 _fn, _get_lambda(getattr(os, _fn)))
131 133
132 134
133 for _fn in _os_path_fns: 135 for _fn in _os_path_fns:
134 if hasattr(os.path, _fn): 136 if hasattr(os.path, _fn):
135 sys.modules[__name__].__dict__.setdefault( 137 sys.modules[__name__].__dict__.setdefault(
136 _fn, _get_lambda(getattr(os.path, _fn))) 138 _fn, _get_lambda(getattr(os.path, _fn)))
OLDNEW
« client/run_isolated.py ('K') | « client/tests/isolateserver_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698