OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright 2014 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 """Builds a local mercurial (hg) copy. |
| 7 |
| 8 This is used by the go toolchain. |
| 9 """ |
| 10 |
| 11 import os |
| 12 import shutil |
| 13 import subprocess |
| 14 import sys |
| 15 |
| 16 import utils |
| 17 |
| 18 |
| 19 def main(): |
| 20 if not os.path.exists('mercurial'): |
| 21 return 'Expected mercurial at %s.' % os.path.abspath('mercurial') |
| 22 |
| 23 os.chdir('mercurial') |
| 24 |
| 25 if utils.GetPlatform() == 'win': |
| 26 subprocess.check_call(['python', 'setup.py', '--pure', 'build_py', '-c', |
| 27 '-d', '.', 'build_ext', |
| 28 '-i', 'build_mo', '--force']) |
| 29 with open('hg.bat', 'w') as put_hg_in_path: |
| 30 # Write a hg.bat since the go toolchain expects to find something called |
| 31 # 'hg' in the path, but Windows only recognizes executables ending with |
| 32 # an extension in PATHEXT. Writing hg.bat effectively makes 'hg' callable |
| 33 # if the mercurial folder is in PATH. |
| 34 mercurial_path = os.path.abspath('hg') |
| 35 put_hg_in_path.write('python %s %%*' % mercurial_path) |
| 36 else: |
| 37 subprocess.check_call(['make', 'local']) |
| 38 |
| 39 if __name__ == '__main__': |
| 40 sys.exit(main()) |
OLD | NEW |