OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 """Simple helper script for building psutil via GYP.""" |
| 7 |
| 8 import os |
| 9 import shutil |
| 10 import subprocess |
| 11 import sys |
| 12 import tempfile |
| 13 |
| 14 |
| 15 def Main(): |
| 16 if len(sys.argv) <= 1: |
| 17 print >> sys.stderr, 'Usage: build.py <output dir>' |
| 18 sys.exit(1) |
| 19 |
| 20 # GYP may specify the output path as a relative path. Since we need cwd to be |
| 21 # the source directory, we must convert the output path to an absolute path. |
| 22 abs_out_path = os.path.abspath(sys.argv[1]) |
| 23 temp_path = tempfile.mkdtemp() |
| 24 try: |
| 25 sys.exit(subprocess.call( |
| 26 ['python', 'setup.py', 'build', '--build-lib', abs_out_path, |
| 27 '--build-temp', temp_path], |
| 28 cwd=os.path.dirname(os.path.abspath(__file__)))) |
| 29 finally: |
| 30 shutil.rmtree(temp_path) |
| 31 |
| 32 |
| 33 if __name__ == '__main__': |
| 34 Main() |
OLD | NEW |