Esempio n. 1
0
    print "\nAll runs completed."
    print "%d passed out of %d total runs." % (results.count(0), len(results))
    print "Results (exit code): %r" % results
    return all(result == 0 for result in results)


def run_tests(args):
    if '--runs' in args:
        return run_tests_multiple(args)
    else:
        return run_tests_single(args)


def _get_browsers():
    """Uses the platform name to configure which browsers will be tested."""
    browsers = None
    if shakaBuildHelpers.is_linux():
        # For MP4 support on Linux Firefox, install gstreamer1.0-libav.
        # Opera on Linux only supports MP4 for Ubuntu 15.04+, so it is not in the
        # default list of browsers for Linux at this time.
        browsers = 'Chrome,Firefox'
    elif shakaBuildHelpers.is_darwin():
        browsers = 'Chrome,Firefox,Safari'
    elif shakaBuildHelpers.is_windows() or shakaBuildHelpers.is_cygwin():
        browsers = 'Chrome,Firefox,IE'
    return browsers


if __name__ == '__main__':
    shakaBuildHelpers.run_main(run_tests)
Esempio n. 2
0
    logging.info('Compiling the library (%s)...', parsed_args.mode)

    custom_build = Build()

    if not custom_build.parse_build(commands, os.getcwd()):
        return 1

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    name = parsed_args.name
    rebuild = parsed_args.force
    is_debug = parsed_args.mode == 'debug'

    if not custom_build.build_library(name, rebuild, is_debug):
        return 1

    if not compile_demo(rebuild, is_debug):
        return 1

    if not compile_receiver(rebuild, is_debug):
        return 1

    return 0


if __name__ == '__main__':
    shakaBuildHelpers.run_main(main)
Esempio n. 3
0
  """Builds the source code documentation."""
  logging.info('Building the docs...')

  parser = argparse.ArgumentParser(
      description=__doc__,
      formatter_class=argparse.RawDescriptionHelpFormatter)
  parser.add_argument(
      '--force',
      '-f',
      help='Force the docs to be built, even if no files have changed.',
      action='store_true')

  parsed_args = parser.parse_args(args)

  base = shakaBuildHelpers.get_source_base()
  config_path = os.path.join(base, 'docs', 'jsdoc.conf.json')
  jsdoc = compiler.Jsdoc(config_path)
  if not jsdoc.build(parsed_args.force):
    return 1
  return 0


# TODO: Remove this alias.  It is here for backward compatibility until private
# scripts depending on it can be updated.
def build_docs(args):
  return main(args)


if __name__ == '__main__':
  shakaBuildHelpers.run_main(main)
Esempio n. 4
0
    '--root_with_prefix=lib ../../../lib',
    '--root_with_prefix=third_party/closure ../../../third_party/closure'
]


def gen_deps(_):
  """Generates the uncompiled dependencies files."""
  print 'Generating Closure dependencies...'

  # Make the dist/ folder, ignore errors.
  base = shakaBuildHelpers.get_source_base()
  try:
    os.mkdir(os.path.join(base, 'dist'))
  except OSError:
    pass
  os.chdir(base)
  deps_writer = os.path.join('third_party', 'closure', 'deps', 'depswriter.py')

  try:
    cmd_line = [sys.executable or 'python', deps_writer] + deps_args
    deps = shakaBuildHelpers.execute_get_output(cmd_line)
    with open(os.path.join(base, 'dist', 'deps.js'), 'w') as f:
      f.write(deps)
    return 0
  except subprocess.CalledProcessError as e:
    return e.returncode


if __name__ == '__main__':
  shakaBuildHelpers.run_main(gen_deps)
Esempio n. 5
0
This deletes the old documentation first.
"""

import os
import shutil

import shakaBuildHelpers


def build_docs(_):
  """Builds the source code documentation."""
  print 'Building the docs...'

  base = shakaBuildHelpers.get_source_base()
  shutil.rmtree(os.path.join(base, 'docs', 'api'), ignore_errors=True)
  os.chdir(base)

  if shakaBuildHelpers.is_windows() or shakaBuildHelpers.is_cygwin():
    # Windows has a different command name.  The Unix version does not seem to
    # work on Cygwin, but the windows one does.
    jsdoc = os.path.join('third_party', 'jsdoc', 'jsdoc.cmd')
  else:
    jsdoc = os.path.join('third_party', 'jsdoc', 'jsdoc')

  cmd_line = [jsdoc, '-c', 'docs/jsdoc.conf.json', '-R', 'docs/api-mainpage.md']
  return shakaBuildHelpers.execute_get_code(cmd_line)


if __name__ == '__main__':
  shakaBuildHelpers.run_main(build_docs)
Esempio n. 6
0
This deletes the old documentation first.
"""

import os
import shutil

import shakaBuildHelpers


def build_docs(_):
  """Builds the source code documentation."""
  print 'Building the docs...'

  base = shakaBuildHelpers.get_source_base()
  shutil.rmtree(os.path.join(base, 'docs', 'api'), ignore_errors=True)
  os.chdir(base)

  if shakaBuildHelpers.is_windows() or shakaBuildHelpers.is_cygwin():
    # Windows has a different command name.  The Unix version does not seem to
    # work on Cygwin, but the windows one does.
    jsdoc = os.path.join('third_party', 'jsdoc', 'jsdoc.cmd')
  else:
    jsdoc = os.path.join('third_party', 'jsdoc', 'jsdoc')

  cmd_line = [jsdoc, '-c', 'docs/jsdoc.conf.json', '-R', 'docs/api-mainpage.md']
  return shakaBuildHelpers.execute_get_code(cmd_line)


if __name__ == '__main__':
  shakaBuildHelpers.run_main(build_docs)
Esempio n. 7
0
    '--root_with_prefix=third_party/closure ../../../third_party/closure'
]


def gen_deps(_):
  """Generates the uncompiled dependencies files."""
  print 'Generating Closure dependencies...'

  # Make the dist/ folder, ignore errors.
  base = shakaBuildHelpers.get_source_base()
  try:
    os.mkdir(os.path.join(base, 'dist'))
  except OSError:
    pass
  os.chdir(base)
  deps_writer = os.path.join('third_party', 'closure', 'deps', 'depswriter.py')

  try:
    cmd_line = ['python', deps_writer] + deps_args
    shakaBuildHelpers.print_cmd_line(cmd_line)
    deps = subprocess.check_output(cmd_line)
    with open(os.path.join(base, 'dist', 'deps.js'), 'w') as f:
      f.write(deps)
    return 0
  except subprocess.CalledProcessError as e:
    return e.returncode


if __name__ == '__main__':
  shakaBuildHelpers.run_main(gen_deps)
Esempio n. 8
0
  ret = 0
  if 'dirty' in git:
    print >> sys.stderr, 'Git version is dirty.'
    ret = 1
  elif 'unknown' in git:
    print >> sys.stderr, 'Git version is not a tag.'
    ret = 1
  elif not re.match(r'^v[0-9]+\.[0-9]+\.[0-9]+(?:-[a-z0-9]+)?$', git):
    print >> sys.stderr, 'Git version is a malformed release version.'
    print >> sys.stderr, 'It should be a \'v\', followed by three numbers'
    print >> sys.stderr, 'separated by dots, optionally followed by a hyphen'
    print >> sys.stderr, 'and a pre-release identifier.  See http://semver.org/'
    ret = 1

  if 'v' + npm != git:
    print >> sys.stderr, 'NPM version does not match git version.'
    ret = 1
  if player != git + '-debug':
    print >> sys.stderr, 'Player version does not match git version.'
    ret = 1
  if 'v' + changelog != git:
    print >> sys.stderr, 'Changelog version does not match git version.'
    ret = 1

  return ret


if __name__ == '__main__':
  shakaBuildHelpers.run_main(check_version)
Esempio n. 9
0
        cmd_line = cmd + ["--browsers", browsers]
        shakaBuildHelpers.print_cmd_line(cmd_line)
        return subprocess.call(cmd_line)
    else:
        # Run with command-line arguments from the user.
        if "--browsers" not in args:
            print "No --browsers specified."
            print "In this mode, browsers must be manually connected to karma."
        cmd_line = cmd + args
        shakaBuildHelpers.print_cmd_line(cmd_line)
        return subprocess.call(cmd_line)


def _get_browsers():
    """Uses the platform name to configure which browsers will be tested."""
    browsers = None
    if shakaBuildHelpers.is_linux():
        # For MP4 support on Linux Firefox, install gstreamer1.0-libav.
        # Opera on Linux only supports MP4 for Ubuntu 15.04+, so it is not in the
        # default list of browsers for Linux at this time.
        browsers = "Chrome,Firefox"
    elif shakaBuildHelpers.is_darwin():
        browsers = "Chrome,Firefox,Safari"
    elif shakaBuildHelpers.is_windows() or shakaBuildHelpers.is_cygwin():
        browsers = "Chrome,Firefox,IE"
    return browsers


if __name__ == "__main__":
    shakaBuildHelpers.run_main(run_tests)