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