| OLD | NEW |
| 1 # Copyright 2014 Dirk Pranke. All rights reserved. | 1 # Copyright 2014 Dirk Pranke. All rights reserved. |
| 2 # | 2 # |
| 3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
| 5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
| 6 # | 6 # |
| 7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 # | 8 # |
| 9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
| 10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 self.stdin = sys.stdin | 50 self.stdin = sys.stdin |
| 51 self.env = os.environ | 51 self.env = os.environ |
| 52 self.platform = sys.platform | 52 self.platform = sys.platform |
| 53 | 53 |
| 54 def abspath(self, *comps): | 54 def abspath(self, *comps): |
| 55 return os.path.abspath(self.join(*comps)) | 55 return os.path.abspath(self.join(*comps)) |
| 56 | 56 |
| 57 def add_to_path(self, *comps): | 57 def add_to_path(self, *comps): |
| 58 absolute_path = self.abspath(*comps) | 58 absolute_path = self.abspath(*comps) |
| 59 if absolute_path not in sys.path: | 59 if absolute_path not in sys.path: |
| 60 sys.path.append(absolute_path) | 60 sys.path.insert(0, absolute_path) |
| 61 | 61 |
| 62 def basename(self, path): | 62 def basename(self, path): |
| 63 return os.path.basename(path) | 63 return os.path.basename(path) |
| 64 | 64 |
| 65 def call(self, argv, stdin=None, env=None): | 65 def call(self, argv, stdin=None, env=None): |
| 66 if stdin: | 66 if stdin: |
| 67 stdin_pipe = subprocess.PIPE | 67 stdin_pipe = subprocess.PIPE |
| 68 else: | 68 else: |
| 69 stdin_pipe = None | 69 stdin_pipe = None |
| 70 proc = subprocess.Popen(argv, stdout=subprocess.PIPE, | 70 proc = subprocess.Popen(argv, stdout=subprocess.PIPE, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 self.truncate(0) | 277 self.truncate(0) |
| 278 self.capturing = True | 278 self.capturing = True |
| 279 self.diverting = divert | 279 self.diverting = divert |
| 280 | 280 |
| 281 def restore(self): | 281 def restore(self): |
| 282 msg = self.getvalue() | 282 msg = self.getvalue() |
| 283 self.truncate(0) | 283 self.truncate(0) |
| 284 self.capturing = False | 284 self.capturing = False |
| 285 self.diverting = False | 285 self.diverting = False |
| 286 return msg | 286 return msg |
| OLD | NEW |