OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 # |
| 4 # Use of this source code is governed by a BSD-style license |
| 5 # that can be found in the LICENSE file in the root of the source |
| 6 # tree. An additional intellectual property rights grant can be found |
| 7 # in the file PATENTS. All contributing project authors may |
| 8 # be found in the AUTHORS file in the root of the source tree. |
| 9 |
| 10 """Builds a local mercurial (hg) copy. |
| 11 |
| 12 This is used by the go toolchain. |
| 13 """ |
| 14 |
| 15 import os |
| 16 import subprocess |
| 17 import sys |
| 18 |
| 19 import utils |
| 20 |
| 21 |
| 22 def main(): |
| 23 if not os.path.exists('mercurial'): |
| 24 return 'Expected mercurial at %s.' % os.path.abspath('mercurial') |
| 25 |
| 26 os.chdir('mercurial') |
| 27 |
| 28 if utils.GetPlatform() == 'win': |
| 29 subprocess.check_call(['python', 'setup.py', '--pure', 'build_py', '-c', |
| 30 '-d', '.', 'build_ext', |
| 31 '-i', 'build_mo', '--force']) |
| 32 with open('hg.bat', 'w') as put_hg_in_path: |
| 33 # Write a hg.bat since the go toolchain expects to find something called |
| 34 # 'hg' in the path, but Windows only recognizes executables ending with |
| 35 # an extension in PATHEXT. Writing hg.bat effectively makes 'hg' callable |
| 36 # if the mercurial folder is in PATH. |
| 37 mercurial_path = os.path.abspath('hg') |
| 38 put_hg_in_path.write('python %s %%*' % mercurial_path) |
| 39 else: |
| 40 subprocess.check_call(['make', 'local']) |
| 41 |
| 42 if __name__ == '__main__': |
| 43 sys.exit(main()) |
OLD | NEW |