Пример #1
0
def node_path():
    try:
        old_sys_path = sys.path[:]
        sys.path.append(path.join(third_party_path(), 'node'))
        import node
    finally:
        sys.path = old_sys_path
    return node.GetBinaryPath()
Пример #2
0
def node_path(options):
    try:
        old_sys_path = sys.path[:]
        sys.path.append(
            os.path.join(options.devtools_dir, 'third_party', 'node'))
        import node
    finally:
        sys.path = old_sys_path
    return node.GetBinaryPath()
Пример #3
0
def _run_node(cmd_parts, stdout=None):
  cmd = " ".join([node.GetBinaryPath()] + cmd_parts)
  process = subprocess.Popen(
      cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
  stdout, stderr = process.communicate()

  if stderr:
    print >> sys.stderr, '%s failed: %s' % (cmd, stderr)
    raise

  return stdout
Пример #4
0
def node_path():
    # Qt WebEngine: Expect node.js to be installed in path.
    if sys.platform == 'win32':
        return 'node.exe'
    else:
        nodejs = which('nodejs')
        if nodejs:
            return nodejs
        nodejs = which('node')
        if nodejs:
            return nodejs
    try:
        old_sys_path = sys.path[:]
        sys.path.append(path.join(third_party_path(), 'node'))
        import node
    finally:
        sys.path = old_sys_path
    return node.GetBinaryPath()
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import optparse
import os
import subprocess
import sys

_HERE_PATH = os.path.abspath(os.path.dirname(__file__))
_JS_SCRIPT_PATH = os.path.join(_HERE_PATH, 'generate_devtools_ui_strings.js')
_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..', '..', '..', '..'))

sys.path.append(os.path.join(_SRC_PATH, 'third_party', 'node'))
# pylint: disable=wrong-import-position
import node  # pylint: disable=import-error
_NODE_PATH = node.GetBinaryPath()


def main():
    parser = optparse.OptionParser(description=__doc__)
    parser.add_option(
        '--root_gen_dir',
        action='store',
        metavar='ROOT_GEN_DIR',
        help='The root directory where the header and cc will be generated.')
    parser.add_option('--output_header', action='store', metavar='OUTPUT_HEADER', help='Generated output .h file for pairs of IDs')
    parser.add_option(
        '--output_cc',
        action='store',
        metavar='OUTPUT_CC',
        help='Generated output .cc file that contains pairs of {front-end string key, IDS_ key}')
Пример #6
0
def node_path():
    return node.GetBinaryPath()