Chromium Code Reviews| Index: build_mercurial_local.py |
| =================================================================== |
| --- build_mercurial_local.py (revision 0) |
| +++ build_mercurial_local.py (working copy) |
| @@ -0,0 +1,40 @@ |
| +#!/usr/bin/python |
| +# Copyright 2014 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +"""Builds a local mercurial (hg) copy. |
| + |
| +This is used by the go toolchain. |
| +""" |
| + |
| +import os |
| +import shutil |
| +import subprocess |
| +import sys |
| + |
| +import utils |
| + |
| + |
| +def main(): |
| + if not os.path.exists('mercurial'): |
| + return 'Expected mercurial at %s.' % os.path.abspath('mercurial') |
| + |
| + os.chdir('mercurial') |
| + |
| + if utils.GetPlatform() == 'win': |
| + subprocess.check_call(['python', 'setup.py', '--pure', 'build_py', '-c', |
| + '-d', '.', 'build_ext', |
| + '-i', 'build_mo', '--force']) |
|
kjellander_chromium
2014/12/08 13:58:08
where does the local copy end up?
Doesn't it need
phoglund_chromium
2014/12/08 14:26:16
This makes the mercurial/hg python script work. It
|
| + with open('hg.bat', 'w') as put_hg_in_path: |
| + # Write a hg.bat since the go toolchain expects to find something called |
| + # 'hg' in the path, but Windows only recognizes executables ending with |
| + # an extension in PATHEXT. Writing hg.bat effectively makes 'hg' callable |
|
kjellander_chromium
2014/12/08 13:58:08
Maybe it would be easiert to add "py" to the PATHE
phoglund_chromium
2014/12/08 14:26:16
No, it's not the make that needs hg, it's golang w
|
| + # if the mercurial folder is in PATH. |
| + mercurial_path = os.path.abspath('hg') |
| + put_hg_in_path.write('python %s %%*' % mercurial_path) |
| + else: |
| + subprocess.check_call(['make', 'local']) |
| + |
| +if __name__ == '__main__': |
| + sys.exit(main()) |
| Property changes on: build_mercurial_local.py |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| ## -0,0 +1 ## |
| +LF |
| \ No newline at end of property |
| Added: svn:executable |
| ## -0,0 +1 ## |
| +* |
| \ No newline at end of property |