예제 #1
0
def main():
  os.chdir(SOURCE_ROOT)

  # Update the VS build env.
  import_vs_env(get_target_arch())

  ninja = os.path.join('vendor', 'depot_tools', 'ninja')
  if sys.platform == 'win32':
    ninja += '.exe'

  args = parse_args()
  if args.libcc:
    if ('D' not in args.configuration
        or not os.path.exists(GCLIENT_DONE)
        or not os.path.exists(os.path.join(LIBCC_DIST_MAIN, 'build.ninja'))):
      sys.stderr.write('--libcc should only be used when '
                       'libchromiumcontent was built with bootstrap.py -d '
                       '--debug_libchromiumcontent' + os.linesep)
      sys.exit(1)
    script = os.path.join(LIBCC_SOURCE_ROOT, 'script', 'build')
    subprocess.check_call([sys.executable, script, '-D', '-t',
                           get_target_arch()])
    subprocess.check_call([ninja, '-C', LIBCC_DIST_MAIN])

  for config in args.configuration:
    build_path = os.path.join('out', config[0])
    ret = subprocess.call([ninja, '-C', build_path, args.target])
    if ret != 0:
      sys.exit(ret)
예제 #2
0
def create_symbols_zip():
  dist_name = '{0}-{1}-{2}-{3}-symbols.zip'.format(PROJECT_NAME,
                                                   ELECTRON_VERSION,
                                                   get_platform_key(),
                                                   get_target_arch())
  zip_file = os.path.join(DIST_DIR, dist_name)
  licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

  with scoped_cwd(DIST_DIR):
    dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)]
    make_zip(zip_file, licenses, dirs)

  if PLATFORM == 'darwin':
    dsym_name = '{0}-{1}-{2}-{3}-dsym.zip'.format(PROJECT_NAME,
                                                  ELECTRON_VERSION,
                                                  get_platform_key(),
                                                  get_target_arch())
    with scoped_cwd(DIST_DIR):
      dsyms = glob.glob('*.dSYM')
      make_zip(os.path.join(DIST_DIR, dsym_name), licenses, dsyms)
  elif PLATFORM == 'win32':
    pdb_name = '{0}-{1}-{2}-{3}-pdb.zip'.format(PROJECT_NAME,
                                                ELECTRON_VERSION,
                                                get_platform_key(),
                                                get_target_arch())
    with scoped_cwd(DIST_DIR):
      pdbs = glob.glob('*.pdb')
      make_zip(os.path.join(DIST_DIR, pdb_name), pdbs + licenses, [])
예제 #3
0
파일: upload.py 프로젝트: shiftkey/electron
def main():
  args = parse_args()
  if  args.upload_to_s3:
    utcnow = datetime.datetime.utcnow()
    args.upload_timestamp = utcnow.strftime('%Y%m%d')

  if not dist_newer_than_head():
    run_python_script('create-dist.py')

  build_version = get_electron_build_version()
  if not ELECTRON_VERSION.startswith(build_version):
    error = 'Tag name ({0}) should match build version ({1})\n'.format(
        ELECTRON_VERSION, build_version)
    sys.stderr.write(error)
    sys.stderr.flush()
    return 1

  tag_exists = False
  release = get_release(args.version)
  if not release['draft']:
    tag_exists = True

  if not args.upload_to_s3:
    assert release['exists'], 'Release does not exist; cannot upload to GitHub!'
    assert tag_exists == args.overwrite, \
          'You have to pass --overwrite to overwrite a published release'

  # Upload Electron files.
  upload_electron(release, os.path.join(DIST_DIR, DIST_NAME), args)
  if get_target_arch() != 'mips64el':
    upload_electron(release, os.path.join(DIST_DIR, SYMBOLS_NAME), args)
  if PLATFORM == 'darwin':
    upload_electron(release, os.path.join(DIST_DIR, 'electron-api.json'), args)
    upload_electron(release, os.path.join(DIST_DIR, 'electron.d.ts'), args)
    upload_electron(release, os.path.join(DIST_DIR, DSYM_NAME), args)
  elif PLATFORM == 'win32':
    upload_electron(release, os.path.join(DIST_DIR, PDB_NAME), args)

  # Upload free version of ffmpeg.
  ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION)
  upload_electron(release, os.path.join(DIST_DIR, ffmpeg), args)

  chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION)
  upload_electron(release, os.path.join(DIST_DIR, chromedriver), args)
  mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION)
  upload_electron(release, os.path.join(DIST_DIR, mksnapshot), args)

  if get_target_arch().startswith('arm'):
    # Upload the x64 binary for arm/arm64 mksnapshot
    mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION, 'x64')
    upload_electron(release, os.path.join(DIST_DIR, mksnapshot), args)

  if not tag_exists and not args.upload_to_s3:
    # Upload symbols to symbol server.
    run_python_script('upload-symbols.py')
    if PLATFORM == 'win32':
      # Upload node headers.
      run_python_script('create-node-headers.py', '-v', args.version)
      run_python_script('upload-node-headers.py', '-v', args.version)
예제 #4
0
def main():
  args = parse_args()

  if not args.publish_release:
    if not dist_newer_than_head():
      create_dist = os.path.join(SOURCE_ROOT, 'script', 'create-dist.py')
      execute([sys.executable, create_dist])

    build_version = get_atom_shell_build_version()
    if not ATOM_SHELL_VERSION.startswith(build_version):
      error = 'Tag name ({0}) should match build version ({1})\n'.format(
          ATOM_SHELL_VERSION, build_version)
      sys.stderr.write(error)
      sys.stderr.flush()
      return 1

  github = GitHub(auth_token())
  releases = github.repos(ATOM_SHELL_REPO).releases.get()
  tag_exists = False
  for release in releases:
    if not release['draft'] and release['tag_name'] == args.version:
      tag_exists = True
      break

  release = create_or_get_release_draft(github, releases, args.version,
                                        tag_exists)

  if args.publish_release:
    # Upload the SHASUMS.txt.
    execute([sys.executable,
             os.path.join(SOURCE_ROOT, 'script', 'upload-checksums.py'),
             '-v', ATOM_SHELL_VERSION])

    # Upload the index.json.
    execute([sys.executable,
             os.path.join(SOURCE_ROOT, 'script', 'upload-index-json.py')])

    # Press the publish button.
    publish_release(github, release['id'])

    # Do not upload other files when passed "-p".
    return

  # Upload atom-shell with GitHub Releases API.
  upload_atom_shell(github, release, os.path.join(DIST_DIR, DIST_NAME))
  upload_atom_shell(github, release, os.path.join(DIST_DIR, SYMBOLS_NAME))

  # Upload chromedriver and mksnapshot for minor version update.
  if get_target_arch() != 'arm' and parse_version(args.version)[2] == '0':
    chromedriver = 'chromedriver-{0}-{1}-{2}.zip'.format(
        get_chromedriver_version(), PLATFORM, get_target_arch())
    upload_atom_shell(github, release, os.path.join(DIST_DIR, chromedriver))
    upload_atom_shell(github, release, os.path.join(DIST_DIR, MKSNAPSHOT_NAME))

  if PLATFORM == 'win32' and not tag_exists:
    # Upload node headers.
    execute([sys.executable,
             os.path.join(SOURCE_ROOT, 'script', 'upload-node-headers.py'),
             '-v', args.version])
예제 #5
0
def strip_binary(binary_path):
    if get_target_arch() == 'arm':
      strip = 'arm-linux-gnueabihf-strip'
    elif get_target_arch() == 'arm64':
      strip = 'aarch64-linux-gnu-strip'
    else:
      strip = 'strip'
    execute([strip, binary_path])
예제 #6
0
def strip_binary(binary_path):
  if get_target_arch() == 'arm':
    strip = 'arm-linux-gnueabihf-strip'
  elif get_target_arch() == 'arm64':
    strip = 'aarch64-linux-gnu-strip'
  elif get_target_arch() == 'mips64el':
    strip = 'mips64el-redhat-linux-strip'
  else:
    strip = 'strip'
  execute([strip, binary_path], env=build_env())
예제 #7
0
def main():
  print('Zipping Symbols')
  if get_target_arch() == 'mips64el':
    return

  args = parse_args()
  dist_name = 'symbols.zip'
  zip_file = os.path.join(args.build_dir, dist_name)
  licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

  with scoped_cwd(args.build_dir):
    dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)]
    print('Making symbol zip: ' + zip_file)
    make_zip(zip_file, licenses, dirs)

  if PLATFORM == 'darwin':
    dsym_name = 'dsym.zip'
    with scoped_cwd(args.build_dir):
      dsyms = glob.glob('*.dSYM')
      dsym_zip_file = os.path.join(args.build_dir, dsym_name)
      print('Making dsym zip: ' + dsym_zip_file)
      make_zip(dsym_zip_file, licenses, dsyms)
  elif PLATFORM == 'win32':
    pdb_name = 'pdb.zip'
    with scoped_cwd(args.build_dir):
      pdbs = glob.glob('*.pdb')
      pdb_zip_file = os.path.join(args.build_dir, pdb_name)
      print('Making pdb zip: ' + pdb_zip_file)
      make_zip(pdb_zip_file, pdbs + licenses, [])
예제 #8
0
def create_chrome_binary_zip(binary, version):
  file_suffix = ''
  create_native_mksnapshot = False
  if binary == 'mksnapshot':
    arch = get_target_arch()
    if arch.startswith('arm'):
      # if the arch is arm/arm64 the mksnapshot executable is an x64 binary,
      # so name it as such.
      file_suffix = 'x64'
      create_native_mksnapshot = True
  dist_name = get_zip_name(binary, version, file_suffix)
  zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)

  files = ['LICENSE', 'LICENSES.chromium.html']
  if PLATFORM == 'win32':
    files += [binary + '.exe']
  else:
    files += [binary]

  with scoped_cwd(DIST_DIR):
    make_zip(zip_file, files, [])

  if create_native_mksnapshot == True:
    # Create a zip with the native version of the mksnapshot binary.
    src = os.path.join(NATIVE_MKSNAPSHOT_DIR, binary)
    dest = os.path.join(DIST_DIR, binary)
    # Copy file and keep the executable bit.
    shutil.copyfile(src, dest)
    os.chmod(dest, os.stat(dest).st_mode | stat.S_IEXEC)

    dist_name = get_zip_name(binary, version)
    zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)
    with scoped_cwd(DIST_DIR):
      make_zip(zip_file, files, [])
예제 #9
0
def parse_args():
  parser = argparse.ArgumentParser(description='Bootstrap this project')
  parser.add_argument('-u', '--url',
                      help='The base URL from which to download '
                      'libchromiumcontent (i.e., the URL you passed to '
                      'libchromiumcontent\'s script/upload script',
                      default=BASE_URL,
                      required=False)
  parser.add_argument('-v', '--verbose',
                      action='store_true',
                      help='Prints the output of the subprocesses')
  parser.add_argument('-d', '--dev', action='store_true',
                      help='Do not download static_library build')
  parser.add_argument('-y', '--yes', '--assume-yes',
                      action='store_true',
                      help='Run non-interactively by assuming "yes" to all ' \
                           'prompts.')
  parser.add_argument('--target_arch', default=get_target_arch(),
                      help='Manually specify the arch to build for')
  parser.add_argument('--build_libchromiumcontent', action='store_true',
                      help='Build local version of libchromiumcontent')
  parser.add_argument('--libcc_source_path', required=False,
                      help='The source path of libchromiumcontent. ' \
                           'NOTE: All options of libchromiumcontent are ' \
                           'required OR let electron choose it')
  parser.add_argument('--libcc_shared_library_path', required=False,
                      help='The shared library path of libchromiumcontent.')
  parser.add_argument('--libcc_static_library_path', required=False,
                      help='The static library path of libchromiumcontent.')
  return parser.parse_args()
예제 #10
0
def upload_node(bucket, access_key, secret_key, version):
  with scoped_cwd(DIST_DIR):
    s3put(bucket, access_key, secret_key, DIST_DIR,
          'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz'))
    s3put(bucket, access_key, secret_key, DIST_DIR,
          'atom-shell/dist/{0}'.format(version), glob.glob('iojs-*.tar.gz'))

  if PLATFORM == 'win32':
    if get_target_arch() == 'ia32':
      node_lib = os.path.join(DIST_DIR, 'node.lib')
      iojs_lib = os.path.join(DIST_DIR, 'win-x86', 'iojs.lib')
    else:
      node_lib = os.path.join(DIST_DIR, 'x64', 'node.lib')
      iojs_lib = os.path.join(DIST_DIR, 'win-x64', 'iojs.lib')
    safe_mkdir(os.path.dirname(node_lib))
    safe_mkdir(os.path.dirname(iojs_lib))

    # Copy atom.lib to node.lib and iojs.lib.
    atom_lib = os.path.join(OUT_DIR, 'node.dll.lib')
    shutil.copy2(atom_lib, node_lib)
    shutil.copy2(atom_lib, iojs_lib)

    # Upload the node.lib.
    s3put(bucket, access_key, secret_key, DIST_DIR,
          'atom-shell/dist/{0}'.format(version), [node_lib])

    # Upload the iojs.lib.
    s3put(bucket, access_key, secret_key, DIST_DIR,
          'atom-shell/dist/{0}'.format(version), [iojs_lib])
예제 #11
0
def main():
  args = parse_args()
  url_prefix = "{root_url}/{version}".format(**vars(args))

  os.chdir(SOURCE_ROOT)
  version_file = os.path.join(SOURCE_ROOT, 'external_binaries', '.version')

  if (is_updated(version_file, args.version)):
    return

  rm_rf('external_binaries')
  safe_mkdir('external_binaries')

  if sys.platform == 'darwin':
    download_and_unzip(url_prefix, 'Mantle')
    download_and_unzip(url_prefix, 'ReactiveCocoa')
    download_and_unzip(url_prefix, 'Squirrel')
  elif sys.platform in ['cygwin', 'win32']:
    download_and_unzip(url_prefix, 'directxsdk-' + get_target_arch())

  # get sccache & set exec bit. https://bugs.python.org/issue15795
  download_and_unzip(url_prefix, 'sccache-{0}-x64'.format(PLATFORM))
  appname = 'sccache'
  if sys.platform == 'win32':
    appname += '.exe'
  add_exec_bit(os.path.join('external_binaries', appname))

  with open(version_file, 'w') as f:
    f.write(args.version)
def main():
  os.chdir(SOURCE_ROOT)

  args = parse_args()
  config = args.configuration

  if args.verbose:
    enable_verbose_mode()

  spec_modules = os.path.join(SOURCE_ROOT, 'spec', 'node_modules')
  out_dir = os.path.join(SOURCE_ROOT, 'out', config)
  version = get_electron_version()
  node_dir = os.path.join(out_dir, 'node-{0}'.format(version))

  # Create node headers
  script_path = os.path.join(SOURCE_ROOT, 'script', 'create-node-headers.py')
  execute_stdout([sys.executable, script_path, '--version', version,
                  '--directory', out_dir])

  if PLATFORM == 'win32':
    lib_dir = os.path.join(node_dir, 'Release')
    safe_mkdir(lib_dir)
    iojs_lib = os.path.join(lib_dir, 'iojs.lib')
    atom_lib = os.path.join(out_dir, 'node.dll.lib')
    shutil.copy2(atom_lib, iojs_lib)
    node_lib = os.path.join(lib_dir, 'node.lib')
    shutil.copy2(atom_lib, node_lib)

  # Native modules can only be compiled against release builds on Windows
  if config[0] == 'R' or PLATFORM != 'win32':
    update_electron_modules(os.path.dirname(spec_modules), get_target_arch(),
                            node_dir)
  else:
    update_node_modules(os.path.dirname(spec_modules))
예제 #13
0
def strip_binaries():
  if get_target_arch() == 'arm':
    strip = 'arm-linux-gnueabihf-strip'
  else:
    strip = 'strip'
  for binary in TARGET_BINARIES[PLATFORM]:
    if binary.endswith('.so') or '.' not in binary:
      execute([strip, os.path.join(DIST_DIR, binary)])
def binary_should_be_downloaded(binary):
  if 'platform' in binary and binary['platform'] != PLATFORM:
    return False

  if 'targetArch' in binary and binary['targetArch'] != get_target_arch():
    return False

  return True
예제 #15
0
def create_symbols_zip():
    dist_name = "{0}-{1}-{2}-{3}-symbols.zip".format(
        PROJECT_NAME, ATOM_SHELL_VERSION, get_platform_key(), get_target_arch()
    )
    zip_file = os.path.join(DIST_DIR, dist_name)
    licenses = ["LICENSE", "LICENSES.chromium.html", "version"]

    with scoped_cwd(DIST_DIR):
        dirs = ["{0}.breakpad.syms".format(PROJECT_NAME)]
        make_zip(zip_file, licenses, dirs)

    if PLATFORM == "darwin":
        dsym_name = "{0}-{1}-{2}-{3}-dsym.zip".format(
            PROJECT_NAME, ATOM_SHELL_VERSION, get_platform_key(), get_target_arch()
        )
        with scoped_cwd(DIST_DIR):
            dsyms = glob.glob("*.dSYM")
            make_zip(os.path.join(DIST_DIR, dsym_name), licenses, dsyms)
예제 #16
0
def update_gyp():
  # Since gyp doesn't support specify link_settings for each configuration,
  # we are not able to link to different libraries in  "Debug" and "Release"
  # configurations.
  # In order to work around this, we decided to generate the configuration
  # for twice, one is to generate "Debug" config, the other one to generate
  # the "Release" config. And the settings are controlled by the variable
  # "libchromiumcontent_component" which is defined before running gyp.
  target_arch = get_target_arch()
  return (run_gyp(target_arch, 0) or run_gyp(target_arch, 1))
예제 #17
0
def create_dist_zip():
  dist_name = '{0}-{1}-{2}-{3}.zip'.format(PROJECT_NAME, ATOM_SHELL_VERSION,
                                           get_platform_key(),
                                           get_target_arch())
  zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)

  with scoped_cwd(DIST_DIR):
    files = TARGET_BINARIES[PLATFORM] +  ['LICENSE', 'LICENSES.chromium.html',
                                          'version']
    dirs = TARGET_DIRECTORIES[PLATFORM]
    make_zip(zip_file, files, dirs)
예제 #18
0
def main():
  os.chdir(SOURCE_ROOT)
  version_file = os.path.join(SOURCE_ROOT, 'external_binaries', '.version')

  if (is_updated(version_file, VERSION)):
    return

  rm_rf('external_binaries')
  safe_mkdir('external_binaries')

  if sys.platform == 'darwin':
    download_and_unzip('Mantle')
    download_and_unzip('ReactiveCocoa')
    download_and_unzip('Squirrel')
  elif sys.platform in ['cygwin', 'win32']:
    download_and_unzip('directxsdk-' + get_target_arch())
    download_and_unzip('vs2012-crt-' + get_target_arch())

  with open(version_file, 'w') as f:
    f.write(VERSION)
예제 #19
0
def main():
    os.chdir(SOURCE_ROOT)
    version_file = os.path.join(SOURCE_ROOT, "external_binaries", ".version")

    if is_updated(version_file, VERSION):
        return

    rm_rf("external_binaries")
    safe_mkdir("external_binaries")

    if sys.platform == "darwin":
        download_and_unzip("Mantle")
        download_and_unzip("ReactiveCocoa")
        download_and_unzip("Squirrel")
    elif sys.platform in ["cygwin", "win32"]:
        download_and_unzip("directxsdk-" + get_target_arch())
        download_and_unzip("vs2015-crt-" + get_target_arch())

    with open(version_file, "w") as f:
        f.write(VERSION)
예제 #20
0
def create_chrome_binary_zip(binary, version):
    dist_name = "{0}-{1}-{2}-{3}.zip".format(binary, version, get_platform_key(), get_target_arch())
    zip_file = os.path.join(SOURCE_ROOT, "dist", dist_name)

    with scoped_cwd(DIST_DIR):
        files = ["LICENSE", "LICENSES.chromium.html"]
        if PLATFORM == "win32":
            files += [binary + ".exe"]
        else:
            files += [binary]
        make_zip(zip_file, files, [])
예제 #21
0
def create_symbols_zip():
  dist_name = '{0}-{1}-{2}-{3}-symbols.zip'.format(PROJECT_NAME,
                                                   ATOM_SHELL_VERSION,
                                                   PLATFORM,
                                                   get_target_arch())
  zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)

  with scoped_cwd(DIST_DIR):
    files = ['LICENSE', 'version']
    dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)]
    make_zip(zip_file, files, dirs)
예제 #22
0
def create_dist_zip():
  dist_name = '{0}-{1}-{2}-{3}.zip'.format(PROJECT_NAME, ATOM_SHELL_VERSION,
                                           PLATFORM, get_target_arch())
  zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)

  with scoped_cwd(DIST_DIR):
    files = TARGET_BINARIES[PLATFORM] +  ['LICENSE', 'version']
    if PLATFORM == 'linux':
      files += [lib for lib in SYSTEM_LIBRARIES if os.path.exists(lib)]
    dirs = TARGET_DIRECTORIES[PLATFORM]
    make_zip(zip_file, files, dirs)
예제 #23
0
파일: build.py 프로젝트: HolmesNY/electron
def main():
  os.chdir(SOURCE_ROOT)

  args = parse_args()
  if args.verbose:
    enable_verbose_mode()

  # Update the VS build env.
  import_vs_env(get_target_arch())

  # decide which ninja executable to use
  ninja_path = args.ninja_path
  if not ninja_path:
    ninja_path = os.path.join('vendor', 'depot_tools', 'ninja')
    if sys.platform == 'win32':
      ninja_path += '.exe'

  # decide how to invoke ninja
  ninja = [ninja_path]
  if is_verbose_mode():
    ninja.append('-v')

  if args.libcc:
    if ('D' not in args.configuration
        or not os.path.exists(GCLIENT_DONE)
        or not os.path.exists(os.path.join(LIBCC_DIST_MAIN, 'build.ninja'))):
      sys.stderr.write('--libcc should only be used when '
                       'libchromiumcontent was built with bootstrap.py -d '
                       '--debug_libchromiumcontent' + os.linesep)
      sys.exit(1)
    script = os.path.join(LIBCC_SOURCE_ROOT, 'script', 'build')
    subprocess.check_call([sys.executable, script, '-D', '-t',
                           get_target_arch()])
    subprocess.check_call(ninja + ['-C', LIBCC_DIST_MAIN])

  env = build_env()
  for config in args.configuration:
    build_path = os.path.join('out', config[0])
    ret = subprocess.call(ninja + ['-C', build_path, args.target], env=env)
    if ret != 0:
      sys.exit(ret)
예제 #24
0
def create_chrome_binary_zip(binary, version):
  dist_name = '{0}-{1}-{2}-{3}.zip'.format(binary, version, get_platform_key(),
                                           get_target_arch())
  zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)

  with scoped_cwd(DIST_DIR):
    files = ['LICENSE', 'LICENSES.chromium.html']
    if PLATFORM == 'win32':
      files += [binary + '.exe']
    else:
      files += [binary]
    make_zip(zip_file, files, [])
예제 #25
0
def create_chromedriver_zip():
  dist_name = 'chromedriver-{0}-{1}-{2}.zip'.format(get_chromedriver_version(),
                                                    PLATFORM, get_target_arch())
  zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)

  with scoped_cwd(DIST_DIR):
    files = ['LICENSE']
    if PLATFORM == 'win32':
      files += ['chromedriver.exe']
    else:
      files += ['chromedriver']
    make_zip(zip_file, files, [])
예제 #26
0
def get_electron_build_version():
    if get_target_arch() == "arm" or os.environ.has_key("CI"):
        # In CI we just build as told.
        return ELECTRON_VERSION
    if PLATFORM == "darwin":
        electron = os.path.join(
            SOURCE_ROOT, "out", "R", "{0}.app".format(PRODUCT_NAME), "Contents", "MacOS", PRODUCT_NAME
        )
    elif PLATFORM == "win32":
        electron = os.path.join(SOURCE_ROOT, "out", "R", "{0}.exe".format(PROJECT_NAME))
    else:
        electron = os.path.join(SOURCE_ROOT, "out", "R", PROJECT_NAME)

    return subprocess.check_output([electron, "--version"]).strip()
예제 #27
0
def get_electron_build_version():
  if get_target_arch().startswith('arm') or os.environ.has_key('CI'):
    # In CI we just build as told.
    return ELECTRON_VERSION
  if PLATFORM == 'darwin':
    electron = os.path.join(SOURCE_ROOT, 'out', 'R',
                              '{0}.app'.format(PRODUCT_NAME), 'Contents',
                              'MacOS', PRODUCT_NAME)
  elif PLATFORM == 'win32':
    electron = os.path.join(SOURCE_ROOT, 'out', 'R',
                              '{0}.exe'.format(PROJECT_NAME))
  else:
    electron = os.path.join(SOURCE_ROOT, 'out', 'R', PROJECT_NAME)

  return subprocess.check_output([electron, '--version']).strip()
예제 #28
0
def get_atom_shell_build_version():
  if get_target_arch() == 'arm' or os.environ.has_key('CI'):
    # In CI we just build as told.
    return ATOM_SHELL_VERSION
  if PLATFORM == 'darwin':
    atom_shell = os.path.join(SOURCE_ROOT, 'out', 'R',
                              '{0}.app'.format(PRODUCT_NAME), 'Contents',
                              'MacOS', PRODUCT_NAME)
  elif PLATFORM == 'win32':
    atom_shell = os.path.join(SOURCE_ROOT, 'out', 'R',
                              '{0}.exe'.format(PROJECT_NAME))
  else:
    atom_shell = os.path.join(SOURCE_ROOT, 'out', 'R', PROJECT_NAME)

  return subprocess.check_output([atom_shell, '--version']).strip()
예제 #29
0
def create_ffmpeg_zip():
  dist_name = 'ffmpeg-{0}-{1}-{2}.zip'.format(
      ATOM_SHELL_VERSION, get_platform_key(), get_target_arch())
  zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)

  if PLATFORM == 'darwin':
    ffmpeg_name = 'libffmpeg.dylib'
  elif PLATFORM == 'linux':
    ffmpeg_name = 'libffmpeg.so'
  elif PLATFORM == 'win32':
    ffmpeg_name = 'ffmpeg.dll'

  shutil.copy2(os.path.join(CHROMIUM_DIR, '..', 'ffmpeg', ffmpeg_name),
               DIST_DIR)
  with scoped_cwd(DIST_DIR):
    make_zip(zip_file, [ffmpeg_name, 'LICENSE', 'LICENSES.chromium.html'], [])
예제 #30
0
def create_symbols():
  if get_target_arch() == 'mips64el':
    return

  destination = os.path.join(DIST_DIR, '{0}.breakpad.syms'.format(PROJECT_NAME))
  dump_symbols = os.path.join(SOURCE_ROOT, 'script', 'dump-symbols.py')
  execute([sys.executable, dump_symbols, destination])

  if PLATFORM == 'darwin':
    dsyms = glob.glob(os.path.join(OUT_DIR, '*.dSYM'))
    for dsym in dsyms:
      shutil.copytree(dsym, os.path.join(DIST_DIR, os.path.basename(dsym)))
  elif PLATFORM == 'win32':
    pdbs = glob.glob(os.path.join(OUT_DIR, '*.pdb'))
    for pdb in pdbs:
      shutil.copy2(pdb, DIST_DIR)
예제 #31
0
def copy_vcruntime_binaries():
    with _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
                         r"SOFTWARE\Microsoft\VisualStudio\14.0\Setup\VC", 0,
                         _winreg.KEY_READ | _winreg.KEY_WOW64_32KEY) as key:
        crt_dir = _winreg.QueryValueEx(key, "ProductDir")[0]

    arch = get_target_arch()
    if arch == "ia32":
        arch = "x86"

    crt_dir += r"redist\{0}\Microsoft.VC140.CRT\\".format(arch)

    dlls = ["msvcp140.dll", "vcruntime140.dll"]

    # Note: copyfile is used to remove the read-only flag
    for dll in dlls:
        shutil.copyfile(crt_dir + dll, os.path.join(DIST_DIR, dll))
        TARGET_BINARIES_EXT.append(dll)
예제 #32
0
def create_ffmpeg_zip():
    dist_name = 'ffmpeg-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION,
                                                get_platform_key(),
                                                get_target_arch())
    zip_file = os.path.join(SOURCE_ROOT, 'dist', dist_name)

    if PLATFORM == 'darwin':
        ffmpeg_name = 'libffmpeg.dylib'
    elif PLATFORM == 'linux':
        ffmpeg_name = 'libffmpeg.so'
    elif PLATFORM == 'win32':
        ffmpeg_name = 'ffmpeg.dll'

    shutil.copy2(os.path.join(CHROMIUM_DIR, '..', 'ffmpeg', ffmpeg_name),
                 DIST_DIR)
    with scoped_cwd(DIST_DIR):
        make_zip(zip_file, [ffmpeg_name, 'LICENSE', 'LICENSES.chromium.html'],
                 [])
예제 #33
0
def upload_node(bucket, access_key, secret_key, version):
    with scoped_cwd(GEN_DIR):
        generated_tar = os.path.join(GEN_DIR, 'node_headers.tar.gz')
        for header_tar in HEADER_TAR_NAMES:
            versioned_header_tar = header_tar.format(version)
            shutil.copy2(generated_tar,
                         os.path.join(GEN_DIR, versioned_header_tar))

        s3put(bucket, access_key, secret_key,
              GEN_DIR, 'atom-shell/dist/{0}'.format(version),
              glob.glob('node-*.tar.gz'))
        s3put(bucket, access_key, secret_key,
              GEN_DIR, 'atom-shell/dist/{0}'.format(version),
              glob.glob('iojs-*.tar.gz'))

    if PLATFORM == 'win32':
        if get_target_arch() == 'ia32':
            node_lib = os.path.join(DIST_DIR, 'node.lib')
            iojs_lib = os.path.join(DIST_DIR, 'win-x86', 'iojs.lib')
            v4_node_lib = os.path.join(DIST_DIR, 'win-x86', 'node.lib')
        else:
            node_lib = os.path.join(DIST_DIR, 'x64', 'node.lib')
            iojs_lib = os.path.join(DIST_DIR, 'win-x64', 'iojs.lib')
            v4_node_lib = os.path.join(DIST_DIR, 'win-x64', 'node.lib')
        safe_mkdir(os.path.dirname(node_lib))
        safe_mkdir(os.path.dirname(iojs_lib))

        # Copy electron.lib to node.lib and iojs.lib.
        electron_lib = os.path.join(OUT_DIR, 'electron.lib')
        shutil.copy2(electron_lib, node_lib)
        shutil.copy2(electron_lib, iojs_lib)
        shutil.copy2(electron_lib, v4_node_lib)

        # Upload the node.lib.
        s3put(bucket, access_key, secret_key, DIST_DIR,
              'atom-shell/dist/{0}'.format(version), [node_lib])

        # Upload the iojs.lib.
        s3put(bucket, access_key, secret_key, DIST_DIR,
              'atom-shell/dist/{0}'.format(version), [iojs_lib])

        # Upload the v4 node.lib.
        s3put(bucket, access_key, secret_key, DIST_DIR,
              'atom-shell/dist/{0}'.format(version), [v4_node_lib])
예제 #34
0
def parse_args():
    parser = argparse.ArgumentParser(description='Bootstrap this project')
    parser.add_argument('-u',
                        '--url',
                        help='The base URL from which to download '
                        'libchromiumcontent (i.e., the URL you passed to '
                        'libchromiumcontent\'s script/upload script',
                        default=BASE_URL,
                        required=False)
    parser.add_argument('-v',
                        '--verbose',
                        action='store_true',
                        help='Prints the output of the subprocesses')
    parser.add_argument('-d',
                        '--dev',
                        action='store_true',
                        help='Do not download static_library build')
    parser.add_argument('-y', '--yes', '--assume-yes',
                        action='store_true',
                        help='Run non-interactively by assuming "yes" to all ' \
                             'prompts.')
    parser.add_argument('--target_arch',
                        default=get_target_arch(),
                        help='Manually specify the arch to build for')
    parser.add_argument('--clang_dir',
                        default='',
                        help='Path to clang binaries')
    parser.add_argument('--disable_clang',
                        action='store_true',
                        help='Use compilers other than clang for building')
    parser.add_argument('--build_libchromiumcontent',
                        action='store_true',
                        help='Build local version of libchromiumcontent')
    parser.add_argument('--libcc_source_path', required=False,
                        help='The source path of libchromiumcontent. ' \
                             'NOTE: All options of libchromiumcontent are ' \
                             'required OR let electron choose it')
    parser.add_argument('--libcc_shared_library_path',
                        required=False,
                        help='The shared library path of libchromiumcontent.')
    parser.add_argument('--libcc_static_library_path',
                        required=False,
                        help='The static library path of libchromiumcontent.')
    return parser.parse_args()
예제 #35
0
def upload_node(bucket, access_key, secret_key, version):
  with scoped_cwd(DIST_DIR):
    s3put(bucket, access_key, secret_key, DIST_DIR,
          'atom-shell/dist/{0}'.format(version), glob.glob('node-*.tar.gz'))

  if PLATFORM == 'win32':
    if get_target_arch() == 'ia32':
      node_lib = os.path.join(DIST_DIR, 'node.lib')
    else:
      node_lib = os.path.join(DIST_DIR, 'x64', 'node.lib')
      safe_mkdir(os.path.dirname(node_lib))

    # Copy atom.lib to node.lib
    atom_lib = os.path.join(OUT_DIR, 'node.dll.lib')
    shutil.copy2(atom_lib, node_lib)

    # Upload the node.lib.
    s3put(bucket, access_key, secret_key, DIST_DIR,
          'atom-shell/dist/{0}'.format(version), [node_lib])
예제 #36
0
def main():
    os.chdir(SOURCE_ROOT)
    version_file = os.path.join(SOURCE_ROOT, 'external_binaries', '.version')

    if (is_updated(version_file, VERSION)):
        return

    rm_rf('external_binaries')
    safe_mkdir('external_binaries')

    if sys.platform == 'darwin':
        download_and_unzip('Mantle')
        download_and_unzip('ReactiveCocoa')
        download_and_unzip('Squirrel')
    elif sys.platform in ['cygwin', 'win32']:
        download_and_unzip('directxsdk-' + get_target_arch())

    with open(version_file, 'w') as f:
        f.write(VERSION)
예제 #37
0
def copy_ucrt_binaries():
    with _winreg.OpenKey(
            _winreg.HKEY_LOCAL_MACHINE,
            r"SOFTWARE\Microsoft\Windows Kits\Installed Roots") as key:
        ucrt_dir = _winreg.QueryValueEx(key, "KitsRoot10")[0]

    arch = get_target_arch()
    if arch == "ia32":
        arch = "x86"

    ucrt_dir += r"Redist\ucrt\DLLs\{0}".format(arch)

    dlls = glob.glob(os.path.join(ucrt_dir, '*.dll'))
    if len(dlls) == 0:
        raise Exception('UCRT files not found')

    for dll in dlls:
        shutil.copy2(dll, DIST_DIR)
        TARGET_BINARIES_EXT.append(os.path.basename(dll))
예제 #38
0
def parse_args():
  parser = argparse.ArgumentParser(description='Bootstrap this project')
  parser.add_argument('-u', '--url',
                      help='The base URL from which to download '
                      'libchromiumcontent (i.e., the URL you passed to '
                      'libchromiumcontent\'s script/upload script',
                      default=BASE_URL,
                      required=False)
  parser.add_argument('-v', '--verbose',
                      action='store_true',
                      help='Prints the output of the subprocesses')
  parser.add_argument('-d', '--dev', action='store_true',
                      help='Do not download static_library build')
  parser.add_argument('-y', '--yes', '--assume-yes',
                      action='store_true',
                      help='Run non-interactively by assuming "yes" to all ' \
                           'prompts.')
  parser.add_argument('--target_arch', default=get_target_arch(),
                      help='Manually specify the arch to build for')
  return parser.parse_args()
예제 #39
0
def main():
    if get_target_arch() == 'mips64el':
        return

    dist_name = 'symbols.zip'
    zip_file = os.path.join(OUT_DIR, dist_name)
    licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

    with scoped_cwd(OUT_DIR):
        dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)]
        make_zip(zip_file, licenses, dirs)

    if PLATFORM == 'darwin':
        dsym_name = 'dsym.zip'
        with scoped_cwd(OUT_DIR):
            dsyms = glob.glob('*.dSYM')
            make_zip(os.path.join(OUT_DIR, dsym_name), licenses, dsyms)
    elif PLATFORM == 'win32':
        pdb_name = 'pdb.zip'
        with scoped_cwd(OUT_DIR):
            pdbs = glob.glob('*.pdb')
            make_zip(os.path.join(OUT_DIR, pdb_name), pdbs + licenses, [])
예제 #40
0
def parse_args():
    parser = argparse.ArgumentParser(description='Bootstrap this project')
    parser.add_argument('-v',
                        '--verbose',
                        action='store_true',
                        help='Prints the output of subprocesses')
    parser.add_argument('-d',
                        '--dev',
                        action='store_true',
                        help='Do not download static_library build')
    parser.add_argument('--msvs',
                        action='store_true',
                        help='Generate Visual Studio project')
    parser.add_argument('--target_arch',
                        default=get_target_arch(),
                        help='Manually specify the arch to build for')
    parser.add_argument('--clang_dir',
                        default='',
                        help='Path to clang binaries')
    parser.add_argument('--disable_clang',
                        action='store_true',
                        help='Use compilers other than clang for building')
    parser.add_argument('--build_libchromiumcontent',
                        action='store_true',
                        help='Build local version of libchromiumcontent')
    parser.add_argument('--libcc_source_path', required=False,
                        help='The source path of libchromiumcontent. ' \
                        'NOTE: All options of libchromiumcontent are ' \
                        'required OR let electron choose it')
    parser.add_argument('--libcc_shared_library_path',
                        required=False,
                        help='The shared library path of libchromiumcontent.')
    parser.add_argument('--libcc_static_library_path',
                        required=False,
                        help='The static library path of libchromiumcontent.')
    parser.add_argument('--defines',
                        default='',
                        help='The build variables passed to gyp')
    return parser.parse_args()
예제 #41
0
def create_symbols_zip():
    if get_target_arch() == 'mips64el':
        return

    dist_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'symbols')
    zip_file = os.path.join(DIST_DIR, dist_name)
    licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

    with scoped_cwd(DIST_DIR):
        dirs = ['{0}.breakpad.syms'.format(PROJECT_NAME)]
        make_zip(zip_file, licenses, dirs)

    if PLATFORM == 'darwin':
        dsym_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'dsym')
        with scoped_cwd(DIST_DIR):
            dsyms = glob.glob('*.dSYM')
            make_zip(os.path.join(DIST_DIR, dsym_name), licenses, dsyms)
    elif PLATFORM == 'win32':
        pdb_name = get_zip_name(PROJECT_NAME, ELECTRON_VERSION, 'pdb')
        with scoped_cwd(DIST_DIR):
            pdbs = glob.glob('*.pdb')
            make_zip(os.path.join(DIST_DIR, pdb_name), pdbs + licenses, [])
예제 #42
0
def main():
    print('Zipping Symbols')
    if get_target_arch() == 'mips64el':
        return

    args = parse_args()
    dist_name = 'symbols.zip'
    zip_file = os.path.join(args.build_dir, dist_name)
    licenses = ['LICENSE', 'LICENSES.chromium.html', 'version']

    with scoped_cwd(args.build_dir):
        dirs = ['breakpad_symbols']
        print('Making symbol zip: ' + zip_file)
        make_zip(zip_file, licenses, dirs)

    if PLATFORM == 'darwin':
        dsym_name = 'dsym.zip'
        with scoped_cwd(args.build_dir):
            dsyms = glob.glob('*.dSYM')
            dsym_zip_file = os.path.join(args.build_dir, dsym_name)
            print('Making dsym zip: ' + dsym_zip_file)
            make_zip(dsym_zip_file, licenses, dsyms)
            if len(dsyms) > 0 and 'DELETE_DSYMS_AFTER_ZIP' in os.environ:
                execute(['rm', '-rf'] + dsyms)
    elif PLATFORM == 'win32':
        pdb_name = 'pdb.zip'
        with scoped_cwd(args.build_dir):
            pdbs = glob.glob('*.pdb')
            pdb_zip_file = os.path.join(args.build_dir, pdb_name)
            print('Making pdb zip: ' + pdb_zip_file)
            make_zip(pdb_zip_file, pdbs + licenses, [])
    elif PLATFORM == 'linux':
        debug_name = 'debug.zip'
        with scoped_cwd(args.build_dir):
            dirs = ['debug']
            debug_zip_file = os.path.join(args.build_dir, debug_name)
            print('Making debug zip: ' + debug_zip_file)
            make_zip(debug_zip_file, licenses, dirs)
예제 #43
0
def main():
    rm_rf(DIST_DIR)
    os.makedirs(DIST_DIR)

    target_arch = get_target_arch()

    force_build()
    create_symbols()
    copy_binaries()
    copy_chrome_binary('chromedriver')
    copy_chrome_binary('mksnapshot')
    copy_license()

    if PLATFORM == 'linux':
        strip_binaries()
        if target_arch != 'arm':
            copy_system_libraries()

    create_version()
    create_dist_zip()
    create_chrome_binary_zip('chromedriver', get_chromedriver_version())
    create_chrome_binary_zip('mksnapshot', ATOM_SHELL_VERSION)
    create_symbols_zip()
예제 #44
0
def upload_node(bucket, access_key, secret_key, version):
    with scoped_cwd(dist_dir()):
        s3put(bucket, access_key, secret_key,
              dist_dir(), 'atom-shell/dist/{0}'.format(version),
              glob.glob('node-*.tar.gz'))
        s3put(bucket, access_key, secret_key,
              dist_dir(), 'atom-shell/dist/{0}'.format(version),
              glob.glob('iojs-*.tar.gz'))

    if PLATFORM == 'win32':
        if get_target_arch() != 'x64':
            node_lib = os.path.join(dist_dir(), 'node.lib')
            node2_lib = os.path.join(dist_dir(), 'win-x86', 'node.lib')
            iojs_lib = os.path.join(dist_dir(), 'win-x86', 'iojs.lib')
        else:
            node_lib = os.path.join(dist_dir(), 'x64', 'node.lib')
            node2_lib = os.path.join(dist_dir(), 'win-x64', 'node.lib')
            iojs_lib = os.path.join(dist_dir(), 'win-x64', 'iojs.lib')
        safe_mkdir(os.path.dirname(node_lib))
        safe_mkdir(os.path.dirname(node2_lib))
        safe_mkdir(os.path.dirname(iojs_lib))

        # Copy atom.lib to node.lib and iojs.lib.
        atom_lib = os.path.join(output_dir(), 'node_import.lib')
        shutil.copy2(atom_lib, node_lib)
        shutil.copy2(atom_lib, node2_lib)
        shutil.copy2(atom_lib, iojs_lib)

        # Upload the node.lib.
        s3put(bucket, access_key, secret_key, dist_dir(),
              'atom-shell/dist/{0}'.format(version), [node_lib])
        s3put(bucket, access_key, secret_key, dist_dir(),
              'atom-shell/dist/{0}'.format(version), [node2_lib])

        # Upload the iojs.lib.
        s3put(bucket, access_key, secret_key, dist_dir(),
              'atom-shell/dist/{0}'.format(version), [iojs_lib])
예제 #45
0
def main():
    os.chdir(SOURCE_ROOT)

    args = parse_args()
    config = args.configuration

    if args.verbose:
        enable_verbose_mode()

    spec_modules = os.path.join(SOURCE_ROOT, 'spec', 'node_modules')
    out_dir = os.path.join(SOURCE_ROOT, 'out', config)
    version = get_electron_version()
    node_dir = os.path.join(out_dir, 'node-{0}'.format(version))

    # Create node headers
    script_path = os.path.join(SOURCE_ROOT, 'script', 'create-node-headers.py')
    execute_stdout([
        sys.executable, script_path, '--version', version, '--directory',
        out_dir
    ])

    if PLATFORM == 'win32':
        lib_dir = os.path.join(node_dir, 'Release')
        safe_mkdir(lib_dir)
        iojs_lib = os.path.join(lib_dir, 'iojs.lib')
        atom_lib = os.path.join(out_dir, 'node.dll.lib')
        shutil.copy2(atom_lib, iojs_lib)
        node_lib = os.path.join(lib_dir, 'node.lib')
        shutil.copy2(atom_lib, node_lib)

    # Native modules can only be compiled against release builds on Windows
    if config[0] == 'R' or PLATFORM != 'win32':
        update_electron_modules(os.path.dirname(spec_modules),
                                get_target_arch(), node_dir)
    else:
        update_node_modules(os.path.dirname(spec_modules))
예제 #46
0
파일: build.py 프로젝트: go-meson/framework
def main():
  os.chdir(SOURCE_ROOT)

  # Update the VS build env.
  import_vs_env(get_target_arch())

  ninja = os.path.join('vendor', 'depot_tools', 'ninja')
  if sys.platform == 'win32':
    ninja += '.exe'

  args = parse_args()
  for config in args.configuration:
    build_path = os.path.join('out', config[0])
    build_targets = BUILD_TARGETS[PLATFORM]
    if args.target != '':
        build_targets = [args.target]

    for build_target in build_targets:
      cmds = [ninja, '-C', build_path, build_target]
      if args.verbose:
        cmds.append('-v')
      ret = subprocess.call(cmds)
      if ret != 0:
        sys.exit(ret)
예제 #47
0
파일: upload.py 프로젝트: soyzhc/electron
def main():
    args = parse_args()
    if args.upload_to_s3:
        utcnow = datetime.datetime.utcnow()
        args.upload_timestamp = utcnow.strftime('%Y%m%d')

    build_version = get_electron_build_version()
    if not ELECTRON_VERSION.startswith(build_version):
        error = 'Tag name ({0}) should match build version ({1})\n'.format(
            ELECTRON_VERSION, build_version)
        sys.stderr.write(error)
        sys.stderr.flush()
        return 1

    tag_exists = False
    release = get_release(args.version)
    if not release['draft']:
        tag_exists = True

    if not args.upload_to_s3:
        assert release[
            'exists'], 'Release does not exist; cannot upload to GitHub!'
        assert tag_exists == args.overwrite, \
              'You have to pass --overwrite to overwrite a published release'

    # Upload Electron files.
    # Rename dist.zip to  get_zip_name('electron', version, suffix='')
    electron_zip = os.path.join(OUT_DIR, DIST_NAME)
    shutil.copy2(os.path.join(OUT_DIR, 'dist.zip'), electron_zip)
    upload_electron(release, electron_zip, args)
    if get_target_arch() != 'mips64el':
        symbols_zip = os.path.join(OUT_DIR, SYMBOLS_NAME)
        shutil.copy2(os.path.join(OUT_DIR, 'symobls.zip'), symbols_zip)
        upload_electron(release, symbols_zip, args)
    if PLATFORM == 'darwin':
        api_path = os.path.join(OUT_DIR, 'electron-api.json')
        upload_electron(release, api_path, args)

        ts_defs_path = os.path.join(OUT_DIR, 'electron.d.ts')
        upload_electron(release, ts_defs_path, args)
        dsym_zip = os.path.join(OUT_DIR, DSYM_NAME)
        shutil.copy2(os.path.join(OUT_DIR, 'dsym.zip'), dsym_zip)
        upload_electron(release, dsym_zip, args)
    elif PLATFORM == 'win32':
        upload_electron(release, os.path.join(OUT_DIR, PDB_NAME), args)

    # Upload free version of ffmpeg.
    ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION)
    ffmpeg_zip = os.path.join(OUT_DIR, ffmpeg)
    shutil.copy2(os.path.join(OUT_DIR, 'ffmpeg.zip'), ffmpeg_zip)
    upload_electron(release, ffmpeg_zip, args)

    chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION)
    chromedriver_zip = os.path.join(OUT_DIR, chromedriver)
    shutil.copy2(os.path.join(OUT_DIR, 'chromedriver.zip'), chromedriver_zip)
    upload_electron(release, chromedriver_zip, args)

    mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION)
    mksnapshot_zip = os.path.join(OUT_DIR, mksnapshot)
    if get_target_arch().startswith('arm'):
        # Upload the native mksnapshot as mksnapshot.zip
        shutil.copy2(
            os.path.join(GN_SRC_DIR, 'out', 'native_mksnapshot',
                         'native_mksnapshot.zip'), mksnapshot_zip)
        upload_electron(release, mksnapshot_zip, args)
        # Upload the x64 binary for arm/arm64 mksnapshot
        mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION, 'x64')
        mksnapshot_zip = os.path.join(OUT_DIR, mksnapshot)

    shutil.copy2(os.path.join(OUT_DIR, 'mksnapshot.zip'), mksnapshot_zip)
    upload_electron(release, mksnapshot_zip, args)

    if not tag_exists and not args.upload_to_s3:
        # Upload symbols to symbol server.
        run_python_script('upload-symbols.py')
        if PLATFORM == 'win32':
            run_python_script('upload-node-headers.py', '-v', args.version)
예제 #48
0
파일: upload.py 프로젝트: soyzhc/electron
def get_electron_build_version():
    if get_target_arch().startswith('arm') or os.environ.has_key('CI'):
        # In CI we just build as told.
        return ELECTRON_VERSION
    electron = get_electron_exec()
    return subprocess.check_output([electron, '--version']).strip()
예제 #49
0
def main():
    args = parse_args()

    if not dist_newer_than_head():
        run_python_script('create-dist.py')

    build_version = get_electron_build_version()
    if not ELECTRON_VERSION.startswith(build_version):
        error = 'Tag name ({0}) should match build version ({1})\n'.format(
            ELECTRON_VERSION, build_version)
        sys.stderr.write(error)
        sys.stderr.flush()
        return 1

    github = GitHub(auth_token())
    releases = github.repos(ELECTRON_REPO).releases.get()
    tag_exists = False
    for r in releases:
        if not r['draft'] and r['tag_name'] == args.version:
            release = r
            tag_exists = True
            break

    if not args.upload_to_s3:
        assert tag_exists == args.overwrite, \
              'You have to pass --overwrite to overwrite a published release'
        if not args.overwrite:
            release = create_or_get_release_draft(github, releases,
                                                  args.version, tag_exists)

    # Upload Electron with GitHub Releases API.
    upload_electron(github, release, os.path.join(DIST_DIR, DIST_NAME),
                    args.upload_to_s3)
    if get_target_arch() != 'mips64el':
        upload_electron(github, release, os.path.join(DIST_DIR, SYMBOLS_NAME),
                        args.upload_to_s3)
    if PLATFORM == 'darwin':
        upload_electron(github, release,
                        os.path.join(DIST_DIR, 'electron-api.json'),
                        args.upload_to_s3)
        upload_electron(github, release, os.path.join(DIST_DIR,
                                                      'electron.d.ts'),
                        args.upload_to_s3)
        upload_electron(github, release, os.path.join(DIST_DIR, DSYM_NAME),
                        args.upload_to_s3)
    elif PLATFORM == 'win32':
        upload_electron(github, release, os.path.join(DIST_DIR, PDB_NAME),
                        args.upload_to_s3)

    # Upload free version of ffmpeg.
    ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION)
    upload_electron(github, release, os.path.join(DIST_DIR, ffmpeg),
                    args.upload_to_s3)

    # Upload chromedriver and mksnapshot for minor version update.
    if parse_version(args.version)[2] == '0':
        chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION)
        upload_electron(github, release, os.path.join(DIST_DIR, chromedriver),
                        args.upload_to_s3)
        mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION)
        upload_electron(github, release, os.path.join(DIST_DIR, mksnapshot),
                        args.upload_to_s3)

    if PLATFORM == 'win32' and not tag_exists and not args.upload_to_s3:
        # Upload PDBs to Windows symbol server.
        run_python_script('upload-windows-pdb.py')

        # Upload node headers.
        run_python_script('create-node-headers.py', '-v', args.version)
        run_python_script('upload-node-headers.py', '-v', args.version)
예제 #50
0
파일: upload.py 프로젝트: xiwc/electron
                       get_platform_key
from lib.util import atom_gyp, execute, get_atom_shell_version, parse_version, \
                     scoped_cwd
from lib.github import GitHub

ATOM_SHELL_REPO = 'atom/electron'
ATOM_SHELL_VERSION = get_atom_shell_version()

PROJECT_NAME = atom_gyp()['project_name%']
PRODUCT_NAME = atom_gyp()['product_name%']

SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
DIST_NAME = '{0}-{1}-{2}-{3}.zip'.format(PROJECT_NAME, ATOM_SHELL_VERSION,
                                         get_platform_key(), get_target_arch())
SYMBOLS_NAME = '{0}-{1}-{2}-{3}-symbols.zip'.format(PROJECT_NAME,
                                                    ATOM_SHELL_VERSION,
                                                    get_platform_key(),
                                                    get_target_arch())
MKSNAPSHOT_NAME = 'mksnapshot-{0}-{1}-{2}.zip'.format(ATOM_SHELL_VERSION,
                                                      get_platform_key(),
                                                      get_target_arch())


def main():
    args = parse_args()

    if not args.publish_release:
        if not dist_newer_than_head():
            create_dist = os.path.join(SOURCE_ROOT, 'script', 'create-dist.py')
예제 #51
0
파일: upload.py 프로젝트: xiwc/electron
def main():
    args = parse_args()

    if not args.publish_release:
        if not dist_newer_than_head():
            create_dist = os.path.join(SOURCE_ROOT, 'script', 'create-dist.py')
            execute([sys.executable, create_dist])

        build_version = get_atom_shell_build_version()
        if not ATOM_SHELL_VERSION.startswith(build_version):
            error = 'Tag name ({0}) should match build version ({1})\n'.format(
                ATOM_SHELL_VERSION, build_version)
            sys.stderr.write(error)
            sys.stderr.flush()
            return 1

    github = GitHub(auth_token())
    releases = github.repos(ATOM_SHELL_REPO).releases.get()
    tag_exists = False
    for release in releases:
        if not release['draft'] and release['tag_name'] == args.version:
            tag_exists = True
            break

    release = create_or_get_release_draft(github, releases, args.version,
                                          tag_exists)

    if args.publish_release:
        # Upload the SHASUMS.txt.
        execute([
            sys.executable,
            os.path.join(SOURCE_ROOT, 'script', 'upload-checksums.py'), '-v',
            ATOM_SHELL_VERSION
        ])

        # Upload the index.json.
        execute([
            sys.executable,
            os.path.join(SOURCE_ROOT, 'script', 'upload-index-json.py')
        ])

        # Press the publish button.
        publish_release(github, release['id'])

        # Do not upload other files when passed "-p".
        return

    # Upload atom-shell with GitHub Releases API.
    upload_atom_shell(github, release, os.path.join(DIST_DIR, DIST_NAME))
    upload_atom_shell(github, release, os.path.join(DIST_DIR, SYMBOLS_NAME))

    # Upload chromedriver and mksnapshot for minor version update.
    if parse_version(args.version)[2] == '0':
        chromedriver = 'chromedriver-{0}-{1}-{2}.zip'.format(
            get_chromedriver_version(), get_platform_key(), get_target_arch())
        upload_atom_shell(github, release,
                          os.path.join(DIST_DIR, chromedriver))
        upload_atom_shell(github, release,
                          os.path.join(DIST_DIR, MKSNAPSHOT_NAME))

    if PLATFORM == 'win32' and not tag_exists:
        # Upload node headers.
        execute([
            sys.executable,
            os.path.join(SOURCE_ROOT, 'script', 'upload-node-headers.py'),
            '-v', args.version
        ])
예제 #52
0

ATOM_SHELL_REPO = 'atom/electron'
ATOM_SHELL_VERSION = get_atom_shell_version()
CHROMEDRIVER_VERSION = get_chromedriver_version()

PROJECT_NAME = atom_gyp()['project_name%']
PRODUCT_NAME = atom_gyp()['product_name%']

SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
DIST_NAME = '{0}-{1}-{2}-{3}.zip'.format(PROJECT_NAME,
                                         ATOM_SHELL_VERSION,
                                         PLATFORM,
                                         get_target_arch())
SYMBOLS_NAME = '{0}-{1}-{2}-{3}-symbols.zip'.format(PROJECT_NAME,
                                                    ATOM_SHELL_VERSION,
                                                    PLATFORM,
                                                    get_target_arch())
CHROMEDRIVER_NAME = 'chromedriver-{0}-{1}-{2}.zip'.format(CHROMEDRIVER_VERSION,
                                                          PLATFORM,
                                                          get_target_arch())


def main():
  args = parse_args()

  if not dist_newer_than_head():
    create_dist = os.path.join(SOURCE_ROOT, 'script', 'create-dist.py')
    execute([sys.executable, create_dist])
예제 #53
0
def main():
    args = parse_args()
    print('[INFO] Running upload...')

    # Enable urllib3 debugging output
    if os.environ.get('DEBUG_HTTP_HEADERS') == 'true':
        logging.basicConfig(level=logging.DEBUG)
        logging.getLogger("urllib3").setLevel(logging.DEBUG)
        logging.debug(
            "DEBUG_HTTP_HEADERS env var is enabled, logging HTTP headers")
        debug_requests_on()

    # BRAVE_REPO is defined in lib/helpers.py for now
    repo = GitHub(get_env_var('GITHUB_TOKEN')).repos(BRAVE_REPO)

    tag = get_brave_version()
    release = get_release(repo, tag, allow_published_release_updates=False)

    if not release:
        print("[INFO] No existing release found, creating new "
              "release for this upload")
        release = create_release_draft(repo, tag)

    print('[INFO] Uploading release {}'.format(release['tag_name']))
    # Upload Brave with GitHub Releases API.
    upload_brave(repo,
                 release,
                 os.path.join(dist_dir(), DIST_NAME),
                 force=args.force)
    upload_brave(repo,
                 release,
                 os.path.join(dist_dir(), SYMBOLS_NAME),
                 force=args.force)
    # if PLATFORM == 'darwin':
    #     upload_brave(repo, release, os.path.join(dist_dir(), DSYM_NAME))
    # elif PLATFORM == 'win32':
    #     upload_brave(repo, release, os.path.join(dist_dir(), PDB_NAME))

    pkgs = get_brave_packages(output_dir(), release_channel(),
                              get_raw_version())

    if PLATFORM == 'darwin':
        for pkg in pkgs:
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), pkg),
                         force=args.force)
    elif PLATFORM == 'win32':
        if get_target_arch() == 'x64':
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), 'brave_installer.exe'),
                         'brave_installer-x64.exe',
                         force=args.force)
            for pkg in pkgs:
                upload_brave(repo,
                             release,
                             os.path.join(output_dir(), pkg),
                             force=args.force)
        else:
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), 'brave_installer.exe'),
                         'brave_installer-ia32.exe',
                         force=args.force)
            for pkg in pkgs:
                upload_brave(repo,
                             release,
                             os.path.join(output_dir(), pkg),
                             force=args.force)
    else:
        if get_target_arch() == 'x64':
            for pkg in pkgs:
                upload_brave(repo,
                             release,
                             os.path.join(output_dir(), pkg),
                             force=args.force)
        else:
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), 'brave-i386.rpm'),
                         force=args.force)
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), 'brave-i386.deb'),
                         force=args.force)

    # mksnapshot = get_zip_name('mksnapshot', get_brave_version())
    # upload_brave(repo, release, os.path.join(dist_dir(), mksnapshot))

    # if PLATFORM == 'win32' and not tag_exists:
    #     # Upload PDBs to Windows symbol server.
    #     run_python_script('upload-windows-pdb.py')

    if os.environ.get('DEBUG_HTTP_HEADERS') == 'true':
        debug_requests_off()
    print('[INFO] Finished upload')
예제 #54
0
def main():
    args = parse_args()
    if args.upload_to_s3:
        utcnow = datetime.datetime.utcnow()
        args.upload_timestamp = utcnow.strftime('%Y-%m-%d_%H:%M:%S')

    if not dist_newer_than_head():
        run_python_script('create-dist.py')

    build_version = get_electron_build_version()
    if not ELECTRON_VERSION.startswith(build_version):
        error = 'Tag name ({0}) should match build version ({1})\n'.format(
            ELECTRON_VERSION, build_version)
        sys.stderr.write(error)
        sys.stderr.flush()
        return 1

    github = GitHub(auth_token())
    releases = github.repos(ELECTRON_REPO).releases.get()
    tag_exists = False
    release = None
    for r in releases:
        if not r['draft'] and r['tag_name'] == args.version:
            release = r
            tag_exists = True
            break

    if not args.upload_to_s3:
        assert tag_exists == args.overwrite, \
              'You have to pass --overwrite to overwrite a published release'
        if not args.overwrite:
            release = create_or_get_release_draft(github, releases,
                                                  args.version, tag_exists)
    elif release is None:
        release = dict(tag_name=args.version)

    # Upload Electron with GitHub Releases API.
    upload_electron(github, release, os.path.join(DIST_DIR, DIST_NAME), args)
    if get_target_arch() != 'mips64el':
        upload_electron(github, release, os.path.join(DIST_DIR, SYMBOLS_NAME),
                        args)
    if PLATFORM == 'darwin':
        upload_electron(github, release,
                        os.path.join(DIST_DIR, 'electron-api.json'), args)
        upload_electron(github, release, os.path.join(DIST_DIR,
                                                      'electron.d.ts'), args)
        upload_electron(github, release, os.path.join(DIST_DIR, DSYM_NAME),
                        args)
    elif PLATFORM == 'win32':
        upload_electron(github, release, os.path.join(DIST_DIR, PDB_NAME),
                        args)

    # Upload free version of ffmpeg.
    ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION)
    upload_electron(github, release, os.path.join(DIST_DIR, ffmpeg), args)

    chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION)
    upload_electron(github, release, os.path.join(DIST_DIR, chromedriver),
                    args)
    mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION)
    upload_electron(github, release, os.path.join(DIST_DIR, mksnapshot), args)

    if get_target_arch().startswith('arm'):
        # Upload the x64 binary for arm/arm64 mksnapshot
        mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION, 'x64')
        upload_electron(github, release, os.path.join(DIST_DIR, mksnapshot),
                        args)

    if not tag_exists and not args.upload_to_s3:
        # Upload symbols to symbol server.
        run_python_script('upload-symbols.py')
        if PLATFORM == 'win32':
            # Upload node headers.
            run_python_script('create-node-headers.py', '-v', args.version)
            run_python_script('upload-node-headers.py', '-v', args.version)
예제 #55
0
def strip_binary(binary_path):
    if get_target_arch() == 'arm':
        strip = 'arm-linux-gnueabihf-strip'
    else:
        strip = 'strip'
    execute([strip, binary_path])
예제 #56
0
파일: upload.py 프로젝트: darwinz/electron
def main():
    args = parse_args()
    if args.verbose:
        enable_verbose_mode()
    if args.upload_to_s3:
        utcnow = datetime.datetime.utcnow()
        args.upload_timestamp = utcnow.strftime('%Y%m%d')

    build_version = get_electron_build_version()
    if not ELECTRON_VERSION.startswith(build_version):
        error = 'Tag name ({0}) should match build version ({1})\n'.format(
            ELECTRON_VERSION, build_version)
        sys.stderr.write(error)
        sys.stderr.flush()
        return 1

    tag_exists = False
    release = get_release(args.version)
    if not release['draft']:
        tag_exists = True

    if not args.upload_to_s3:
        assert release['exists'], \
              'Release does not exist; cannot upload to GitHub!'
        assert tag_exists == args.overwrite, \
              'You have to pass --overwrite to overwrite a published release'

    # Upload Electron files.
    # Rename dist.zip to  get_zip_name('electron', version, suffix='')
    electron_zip = os.path.join(OUT_DIR, DIST_NAME)
    shutil.copy2(os.path.join(OUT_DIR, 'dist.zip'), electron_zip)
    upload_electron(release, electron_zip, args)
    if get_target_arch() != 'mips64el':
        symbols_zip = os.path.join(OUT_DIR, SYMBOLS_NAME)
        shutil.copy2(os.path.join(OUT_DIR, 'symbols.zip'), symbols_zip)
        upload_electron(release, symbols_zip, args)
    if PLATFORM == 'darwin':
        if get_platform_key() == 'darwin' and get_target_arch() == 'x64':
            api_path = os.path.join(ELECTRON_DIR, 'electron-api.json')
            upload_electron(release, api_path, args)

            ts_defs_path = os.path.join(ELECTRON_DIR, 'electron.d.ts')
            upload_electron(release, ts_defs_path, args)

        dsym_zip = os.path.join(OUT_DIR, DSYM_NAME)
        shutil.copy2(os.path.join(OUT_DIR, 'dsym.zip'), dsym_zip)
        upload_electron(release, dsym_zip, args)

        dsym_snaphot_zip = os.path.join(OUT_DIR, DSYM_SNAPSHOT_NAME)
        shutil.copy2(os.path.join(OUT_DIR, 'dsym-snapshot.zip'),
                     dsym_snaphot_zip)
        upload_electron(release, dsym_snaphot_zip, args)
    elif PLATFORM == 'win32':
        pdb_zip = os.path.join(OUT_DIR, PDB_NAME)
        shutil.copy2(os.path.join(OUT_DIR, 'pdb.zip'), pdb_zip)
        upload_electron(release, pdb_zip, args)
    elif PLATFORM == 'linux':
        debug_zip = os.path.join(OUT_DIR, DEBUG_NAME)
        shutil.copy2(os.path.join(OUT_DIR, 'debug.zip'), debug_zip)
        upload_electron(release, debug_zip, args)

        # Upload libcxx_objects.zip for linux only
        libcxx_objects = get_zip_name('libcxx-objects', ELECTRON_VERSION)
        libcxx_objects_zip = os.path.join(OUT_DIR, libcxx_objects)
        shutil.copy2(os.path.join(OUT_DIR, 'libcxx_objects.zip'),
                     libcxx_objects_zip)
        upload_electron(release, libcxx_objects_zip, args)

        # Upload headers.zip and abi_headers.zip as non-platform specific
        if get_target_arch() == "x64":
            cxx_headers_zip = os.path.join(OUT_DIR, 'libcxx_headers.zip')
            upload_electron(release, cxx_headers_zip, args)

            abi_headers_zip = os.path.join(OUT_DIR, 'libcxxabi_headers.zip')
            upload_electron(release, abi_headers_zip, args)

    # Upload free version of ffmpeg.
    ffmpeg = get_zip_name('ffmpeg', ELECTRON_VERSION)
    ffmpeg_zip = os.path.join(OUT_DIR, ffmpeg)
    ffmpeg_build_path = os.path.join(SRC_DIR, 'out', 'ffmpeg', 'ffmpeg.zip')
    shutil.copy2(ffmpeg_build_path, ffmpeg_zip)
    upload_electron(release, ffmpeg_zip, args)

    chromedriver = get_zip_name('chromedriver', ELECTRON_VERSION)
    chromedriver_zip = os.path.join(OUT_DIR, chromedriver)
    shutil.copy2(os.path.join(OUT_DIR, 'chromedriver.zip'), chromedriver_zip)
    upload_electron(release, chromedriver_zip, args)

    mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION)
    mksnapshot_zip = os.path.join(OUT_DIR, mksnapshot)
    if get_target_arch().startswith('arm') and PLATFORM != 'darwin':
        # Upload the x64 binary for arm/arm64 mksnapshot
        mksnapshot = get_zip_name('mksnapshot', ELECTRON_VERSION, 'x64')
        mksnapshot_zip = os.path.join(OUT_DIR, mksnapshot)

    shutil.copy2(os.path.join(OUT_DIR, 'mksnapshot.zip'), mksnapshot_zip)
    upload_electron(release, mksnapshot_zip, args)

    if PLATFORM == 'linux' and get_target_arch() == 'x64':
        # Upload the hunspell dictionaries only from the linux x64 build
        hunspell_dictionaries_zip = os.path.join(OUT_DIR,
                                                 'hunspell_dictionaries.zip')
        upload_electron(release, hunspell_dictionaries_zip, args)

    if not tag_exists and not args.upload_to_s3:
        # Upload symbols to symbol server.
        run_python_upload_script('upload-symbols.py')
        if PLATFORM == 'win32':
            run_python_upload_script('upload-node-headers.py', '-v',
                                     args.version)

    if PLATFORM == 'win32':
        toolchain_profile_zip = os.path.join(OUT_DIR, TOOLCHAIN_PROFILE_NAME)
        with ZipFile(toolchain_profile_zip, 'w') as myzip:
            myzip.write(
                os.path.join(OUT_DIR, 'windows_toolchain_profile.json'),
                'toolchain_profile.json')
        upload_electron(release, toolchain_profile_zip, args)

    return 0
예제 #57
0
def main():
    args = parse_args()

    if not args.publish_release:
        build_version = get_brave_version()
        if not get_brave_version().startswith(build_version):
            error = 'Tag name ({0}) should match build version ({1})\n'.format(
                get_brave_version(), build_version)
            sys.stderr.write(error)
            sys.stderr.flush()
            return 1

    github = GitHub(auth_token())
    releases = github.repos(BRAVE_REPO).releases.get()
    tag_exists = False
    for release in releases:
        if not release['draft'] and release['tag_name'] == args.version:
            tag_exists = True
            break

    release = create_or_get_release_draft(github, releases, args.version,
                                          tag_exists)

    if args.publish_release:
        # Create and upload the Brave SHASUMS*.txt
        release_brave_checksums(github, release)

        # Press the publish button.
        # publish_release(github, release['id'])

        # Do not upload other files when passed "-p".
        return

    # Upload Brave with GitHub Releases API.
    upload_brave(github, release, os.path.join(dist_dir(), DIST_NAME))
    upload_brave(github, release, os.path.join(dist_dir(), SYMBOLS_NAME))
    # if PLATFORM == 'darwin':
    #   upload_brave(github, release, os.path.join(dist_dir(), DSYM_NAME))
    # elif PLATFORM == 'win32':
    #   upload_brave(github, release, os.path.join(dist_dir(), PDB_NAME))

    # Upload chromedriver and mksnapshot.
    chromedriver = get_zip_name('chromedriver', get_chromedriver_version())
    upload_brave(github, release, os.path.join(dist_dir(), chromedriver))

    if PLATFORM == 'darwin':
        upload_brave(github, release, os.path.join(output_dir(), 'Brave.dmg'))
    elif PLATFORM == 'win32':
        if get_target_arch() == 'x64':
            upload_brave(github, release,
                         os.path.join(output_dir(), 'brave_installer.exe'),
                         'brave_installer-x64.exe')
        else:
            upload_brave(github, release,
                         os.path.join(output_dir(), 'brave_installer.exe'),
                         'brave_installer-ia32.exe')
    # TODO: Enable after linux packaging lands
    #else:
    #if get_target_arch() == 'x64':
    #upload_brave(github, release, os.path.join(output_dir(), 'brave-x86_64.rpm'))
    #upload_brave(github, release, os.path.join(output_dir(), 'brave-amd64.deb'))
    #else:
    #upload_brave(github, release, os.path.join(output_dir(), 'brave-i386.rpm'))
    #upload_brave(github, release, os.path.join(output_dir(), 'brave-i386.deb'))

    # mksnapshot = get_zip_name('mksnapshot', get_brave_version())
    # upload_brave(github, release, os.path.join(dist_dir(), mksnapshot))

    # if PLATFORM == 'win32' and not tag_exists:
    #   # Upload PDBs to Windows symbol server.
    #   run_python_script('upload-windows-pdb.py')

    versions = parse_version(args.version)
    version = '.'.join(versions[:3])
예제 #58
0
def main():
    args = parse_args()
    print('[INFO] Running upload...')

    # Repo is defined in lib/helpers.py for now
    repo = GitHub(get_env_var('GITHUB_TOKEN')).repos(BRAVE_REPO)

    tag = get_brave_version()
    release = get_draft(repo, tag)

    if not release:
        print(
            "[INFO] No existing release found, creating new release for this upload"
        )
        release = create_release_draft(repo, tag)

    print('[INFO] Uploading release {}'.format(release['tag_name']))
    # Upload Brave with GitHub Releases API.
    upload_brave(repo,
                 release,
                 os.path.join(dist_dir(), DIST_NAME),
                 force=args.force)
    upload_brave(repo,
                 release,
                 os.path.join(dist_dir(), SYMBOLS_NAME),
                 force=args.force)
    # if PLATFORM == 'darwin':
    #   upload_brave(repo, release, os.path.join(dist_dir(), DSYM_NAME))
    # elif PLATFORM == 'win32':
    #   upload_brave(repo, release, os.path.join(dist_dir(), PDB_NAME))

    # Upload chromedriver and mksnapshot.
    chromedriver = get_zip_name('chromedriver', get_chromedriver_version())
    upload_brave(repo,
                 release,
                 os.path.join(dist_dir(), chromedriver),
                 force=args.force)

    pkgs = yield_brave_packages(output_dir(), release_channel(),
                                get_raw_version())

    if PLATFORM == 'darwin':
        for pkg in pkgs:
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), pkg),
                         force=args.force)
    elif PLATFORM == 'win32':
        if get_target_arch() == 'x64':
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), 'brave_installer.exe'),
                         'brave_installer-x64.exe',
                         force=args.force)
        else:
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), 'brave_installer.exe'),
                         'brave_installer-ia32.exe',
                         force=args.force)
    else:
        if get_target_arch() == 'x64':
            for pkg in pkgs:
                upload_brave(repo,
                             release,
                             os.path.join(output_dir(), pkg),
                             force=args.force)
        else:
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), 'brave-i386.rpm'),
                         force=args.force)
            upload_brave(repo,
                         release,
                         os.path.join(output_dir(), 'brave-i386.deb'),
                         force=args.force)

    # mksnapshot = get_zip_name('mksnapshot', get_brave_version())
    # upload_brave(repo, release, os.path.join(dist_dir(), mksnapshot))

    # if PLATFORM == 'win32' and not tag_exists:
    #   # Upload PDBs to Windows symbol server.
    #   run_python_script('upload-windows-pdb.py')

    versions = parse_version(args.version)
    version = '.'.join(versions[:3])
    print('[INFO] Finished upload')
예제 #59
0
def get_brave_packages(dir, channel, version):
    pkgs = []

    def filecopy(file_path, file_desired):
        file_desired_path = os.path.join(dir, file_desired)
        if os.path.isfile(file_path):
            print('[INFO] Copying file ' + file_path + ' to ' +
                  file_desired_path)
            shutil.copy(file_path, file_desired_path)
        return file_desired_path

    channel_capitalized = '' if (channel
                                 == 'release') else channel.capitalize()
    for file in os.listdir(dir):
        if os.path.isfile(os.path.join(dir, file)):
            file_path = os.path.join(dir, file)
            if PLATFORM == 'darwin':
                channel_capitalized_dashed = '' if (
                    channel == 'release') else ('-' + channel_capitalized)
                channel_capitalized_spaced = '' if (
                    channel == 'release') else (' ' + channel_capitalized)
                file_dmg = 'Brave-Browser' + channel_capitalized_dashed + '.dmg'
                file_pkg = 'Brave-Browser' + channel_capitalized_dashed + '.pkg'

                if re.match(
                        r'Brave Browser' + channel_capitalized_spaced +
                        r'.*\.dmg$', file):
                    filecopy(file_path, file_dmg)
                    pkgs.append(file_dmg)
                elif file == file_dmg:
                    pkgs.append(file_dmg)
                elif re.match(
                        r'Brave Browser' + channel_capitalized_spaced +
                        r'.*\.pkg$', file):
                    filecopy(file_path, file_pkg)
                    pkgs.append(file_pkg)
                elif file == file_pkg:
                    pkgs.append(file_pkg)
            elif PLATFORM == 'linux':
                channel_dashed = '' if (channel == 'release') else ('-' +
                                                                    channel)
                if re.match(
                        r'brave-browser' + channel_dashed + '_' + version +
                        r'.*\.deb$', file):
                    pkgs.append(file)
                elif re.match(
                        r'brave-browser' + channel_dashed + '-' + version +
                        r'.*\.rpm$', file):
                    pkgs.append(file)
            elif PLATFORM == 'win32':
                arch = '32' if (get_target_arch() == 'ia32') else ''
                channel_arch_extension = channel_capitalized + 'Setup' + arch + '.exe'
                file_stub = 'BraveBrowser' + channel_arch_extension
                file_stub_silent = 'BraveBrowserSilent' + channel_arch_extension
                file_stub_untagged = 'BraveBrowserUntagged' + channel_arch_extension
                file_stn = 'BraveBrowserStandalone' + channel_arch_extension
                file_stn_silent = 'BraveBrowserStandaloneSilent' + channel_arch_extension
                file_stn_untagged = 'BraveBrowserStandaloneUntagged' + channel_arch_extension

                if re.match(
                        r'BraveBrowser' + channel_capitalized + r'Setup' +
                        arch + r'_.*\.exe', file):
                    filecopy(file_path, file_stub)
                    pkgs.append(file_stub)
                elif re.match(
                        r'BraveBrowserSilent' + channel_capitalized +
                        r'Setup' + arch + r'_.*\.exe', file):
                    filecopy(file_path, file_stub_silent)
                    pkgs.append(file_stub_silent)
                elif re.match(
                        r'BraveBrowserUntagged' + channel_capitalized +
                        r'Setup' + arch + r'_.*\.exe', file):
                    filecopy(file_path, file_stub_untagged)
                    pkgs.append(file_stub_untagged)
                elif re.match(
                        r'BraveBrowserStandalone' + channel_capitalized +
                        r'Setup' + arch + r'_.*\.exe', file):
                    filecopy(file_path, file_stn)
                    pkgs.append(file_stn)
                elif re.match(
                        r'BraveBrowserStandaloneSilent' + channel_capitalized +
                        r'Setup' + arch + r'_.*\.exe', file):
                    filecopy(file_path, file_stn_silent)
                    pkgs.append(file_stn_silent)
                elif re.match(
                        r'BraveBrowserStandaloneUntagged' +
                        channel_capitalized + r'Setup' + arch + r'_.*\.exe',
                        file):
                    filecopy(file_path, file_stn_untagged)
                    pkgs.append(file_stn_untagged)

    return sorted(list(set(pkgs)))
예제 #60
0
파일: upload.py 프로젝트: lhole/brave-core
def get_brave_packages(dir, channel, version):
    pkgs = []

    def filecopy(file_path, file_desired):
        file_desired_path = os.path.join(dir, file_desired)
        if os.path.isfile(file_path):
            print('[INFO] Copying file ' + file_path + ' to ' +
                  file_desired_path)
            shutil.copy(file_path, file_desired_path)
        return file_desired_path

    channel_capitalized = channel.capitalize()
    for file in os.listdir(dir):
        if os.path.isfile(os.path.join(dir, file)):
            file_path = os.path.join(dir, file)
            if PLATFORM == 'darwin':
                if channel_capitalized == 'Release':
                    file_desired = 'Brave-Browser.dmg'
                    file_desired_pkg = 'Brave-Browser.pkg'
                    if file == 'Brave Browser.dmg':
                        filecopy(file_path, file_desired)
                        pkgs.append(file_desired)
                    elif file == 'Brave Browser.pkg':
                        filecopy(file_path, file_desired_pkg)
                        pkgs.append(file_desired_pkg)
                    elif file == file_desired and file_desired not in pkgs:
                        pkgs.append(file_desired)
                    elif file == file_desired_pkg and file_desired_pkg not in pkgs:
                        pkgs.append(file_desired_pkg)
                else:
                    file_desired = ('Brave-Browser-' +
                                    channel_capitalized + '.dmg')
                    if re.match(r'Brave Browser ' +
                                channel_capitalized + r'.*\.dmg$', file):
                        filecopy(file_path, file_desired)
                        pkgs.append(file_desired)
                    elif file == file_desired:
                        pkgs.append(file_desired)
            elif PLATFORM == 'linux':
                if channel == 'release':
                    if re.match(r'brave-browser' + '_' + version +
                                r'.*\.deb$', file) \
                        or re.match(r'brave-browser' + '-' + version +
                                    r'.*\.rpm$', file):
                        pkgs.append(file)
                else:
                    if re.match(r'brave-browser-' + channel + '_' +
                                version + r'.*\.deb$', file) \
                        or re.match(r'brave-browser-' + channel + '-' +
                                    version + r'.*\.rpm$', file):
                        pkgs.append(file)
            elif PLATFORM == 'win32':
                if get_target_arch() == 'x64':
                    if channel_capitalized == 'Release':
                        file_desired_standalone = (
                            'BraveBrowserStandaloneSetup.exe')
                        file_desired_standalone_silent = (
                            'BraveBrowserStandaloneSilentSetup.exe')
                        file_desired_standalone_untagged = (
                            'BraveBrowserStandaloneUntaggedSetup.exe')
                        file_desired_stub = 'BraveBrowserSetup.exe'
                        file_desired_stub_silent = 'BraveBrowserSilentSetup.exe'
                        file_desired_stub_untagged = 'BraveBrowserUntaggedSetup.exe'
                        if re.match(r'BraveBrowserSetup_.*\.exe', file):
                            filecopy(file_path, file_desired_stub)
                            pkgs.append(file_desired_stub)
                        elif re.match(r'BraveBrowserSilentSetup_.*\.exe', file):
                            filecopy(file_path, file_desired_stub_silent)
                            pkgs.append(file_desired_stub_silent)
                        elif re.match(r'BraveBrowserUntaggedSetup_.*\.exe', file):
                            filecopy(file_path, file_desired_stub_untagged)
                            pkgs.append(file_desired_stub_untagged)
                        elif re.match(
                                r'BraveBrowserStandaloneSetup_.*\.exe',
                                file):
                            filecopy(file_path, file_desired_standalone)
                            pkgs.append(file_desired_standalone)
                        elif re.match(
                                r'BraveBrowserStandaloneSilentSetup_.*\.exe',
                                file):
                            filecopy(file_path, file_desired_standalone_silent)
                            pkgs.append(file_desired_standalone_silent)
                        elif re.match(
                                r'BraveBrowserStandaloneUntaggedSetup_.*\.exe',
                                file):
                            filecopy(file_path, file_desired_standalone_untagged)
                            pkgs.append(file_desired_standalone_untagged)
                    elif channel_capitalized == 'Beta':
                        file_desired_standalone = (
                            'BraveBrowserStandaloneBetaSetup.exe')
                        file_desired_standalone_silent = (
                            'BraveBrowserStandaloneSilentBetaSetup.exe')
                        file_desired_standalone_untagged = (
                            'BraveBrowserStandaloneUntaggedBetaSetup.exe')
                        file_desired_stub = 'BraveBrowserBetaSetup.exe'
                        file_desired_stub_silent = 'BraveBrowserSilentBetaSetup.exe'
                        file_desired_stub_untagged = 'BraveBrowserUntaggedBetaSetup.exe'
                    elif channel_capitalized == 'Dev':
                        file_desired_standalone = (
                            'BraveBrowserStandaloneDevSetup.exe')
                        file_desired_standalone_silent = (
                            'BraveBrowserStandaloneSilentDevSetup.exe')
                        file_desired_standalone_untagged = (
                            'BraveBrowserStandaloneUntaggedDevSetup.exe')
                        file_desired_stub = 'BraveBrowserDevSetup.exe'
                        file_desired_stub_silent = 'BraveBrowserSilentDevSetup.exe'
                        file_desired_stub_untagged = 'BraveBrowserUntaggedDevSetup.exe'
                    if re.match(r'BraveBrowser' + channel_capitalized +
                                r'Setup_.*\.exe', file):
                        filecopy(file_path, file_desired_stub)
                        pkgs.append(file_desired_stub)
                    elif re.match(r'BraveBrowserSilent' + channel_capitalized +
                                  r'Setup_.*\.exe', file):
                        filecopy(file_path, file_desired_stub_silent)
                        pkgs.append(file_desired_stub_silent)
                    elif re.match(r'BraveBrowserUntagged' + channel_capitalized +
                                  r'Setup_.*\.exe', file):
                        filecopy(file_path, file_desired_stub_untagged)
                        pkgs.append(file_desired_stub_untagged)
                    elif re.match(r'BraveBrowserStandalone' +
                                  channel_capitalized + r'Setup_.*\.exe',
                                  file):
                        filecopy(file_path, file_desired_standalone)
                        pkgs.append(file_desired_standalone)
                    elif re.match(r'BraveBrowserStandaloneSilent' +
                                  channel_capitalized + r'Setup_.*\.exe',
                                  file):
                        filecopy(file_path, file_desired_standalone_silent)
                        pkgs.append(file_desired_standalone_silent)
                    elif re.match(r'BraveBrowserStandaloneUntagged' +
                                  channel_capitalized + r'Setup_.*\.exe',
                                  file):
                        filecopy(file_path, file_desired_standalone_untagged)
                        pkgs.append(file_desired_standalone_untagged)
                else:
                    if channel_capitalized == 'Release':
                        file_desired_standalone = (
                            'BraveBrowserStandaloneSetup32.exe')
                        file_desired_standalone_silent = (
                            'BraveBrowserStandaloneSilentSetup32.exe')
                        file_desired_standalone_untagged = (
                            'BraveBrowserStandaloneUntaggedSetup32.exe')
                        file_desired_stub = 'BraveBrowserSetup32.exe'
                        file_desired_stub_silent = 'BraveBrowserSilentSetup32.exe'
                        file_desired_stub_untagged = 'BraveBrowserUntaggedSetup32.exe'
                        if re.match(r'BraveBrowserSetup32_.*\.exe', file):
                            filecopy(file_path, file_desired_stub)
                            pkgs.append(file_desired_stub)
                        elif re.match(r'BraveBrowserSilentSetup32_.*\.exe', file):
                            filecopy(file_path, file_desired_stub_silent)
                            pkgs.append(file_desired_stub_silent)
                        elif re.match(r'BraveBrowserUntaggedSetup32_.*\.exe', file):
                            filecopy(file_path, file_desired_stub_untagged)
                            pkgs.append(file_desired_stub_untagged)
                        elif re.match(
                                r'BraveBrowserStandaloneSetup32_.*\.exe',
                                file):
                            filecopy(file_path, file_desired_standalone)
                            pkgs.append(file_desired_standalone)
                        elif re.match(
                                r'BraveBrowserStandaloneSilentSetup32_.*\.exe',
                                file):
                            filecopy(file_path, file_desired_standalone_silent)
                            pkgs.append(file_desired_standalone_silent)
                        elif re.match(
                                r'BraveBrowserStandaloneUntaggedSetup32_.*\.exe',
                                file):
                            filecopy(file_path, file_desired_standalone_untagged)
                            pkgs.append(file_desired_standalone_untagged)
                    elif channel_capitalized == 'Beta':
                        file_desired_standalone = (
                            'BraveBrowserStandaloneBetaSetup32.exe')
                        file_desired_standalone_silent = (
                            'BraveBrowserStandaloneSilentBetaSetup32.exe')
                        file_desired_standalone_untagged = (
                            'BraveBrowserStandaloneUntaggedBetaSetup32.exe')
                        file_desired_stub = 'BraveBrowserBetaSetup32.exe'
                        file_desired_stub_silent = 'BraveBrowserSilentBetaSetup32.exe'
                        file_desired_stub_untagged = 'BraveBrowserUntaggedBetaSetup32.exe'
                    elif channel_capitalized == 'Dev':
                        file_desired_standalone = (
                            'BraveBrowserStandaloneDevSetup32.exe')
                        file_desired_standalone_silent = (
                            'BraveBrowserStandaloneSilentDevSetup32.exe')
                        file_desired_standalone_untagged = (
                            'BraveBrowserStandaloneUntaggedDevSetup32.exe')
                        file_desired_stub = 'BraveBrowserDevSetup32.exe'
                        file_desired_stub_silent = 'BraveBrowserSilentDevSetup32.exe'
                        file_desired_stub_untagged = 'BraveBrowserUntaggedDevSetup32.exe'
                    if re.match(r'BraveBrowser' + channel_capitalized +
                                r'Setup32_.*\.exe', file):
                        filecopy(file_path, file_desired_stub)
                        pkgs.append(file_desired_stub)
                    elif re.match(r'BraveBrowserSilent' + channel_capitalized +
                                  r'Setup32_.*\.exe', file):
                        filecopy(file_path, file_desired_stub_silent)
                        pkgs.append(file_desired_stub_silent)
                    elif re.match(r'BraveBrowserUntagged' + channel_capitalized +
                                  r'Setup32_.*\.exe', file):
                        filecopy(file_path, file_desired_stub_untagged)
                        pkgs.append(file_desired_stub_untagged)
                    elif re.match(r'BraveBrowserStandalone' +
                                  channel_capitalized + r'Setup32_.*\.exe',
                                  file):
                        filecopy(file_path, file_desired_standalone)
                        pkgs.append(file_desired_standalone)
                    elif re.match(r'BraveBrowserStandaloneSilent' +
                                  channel_capitalized + r'Setup32_.*\.exe',
                                  file):
                        filecopy(file_path, file_desired_standalone_silent)
                        pkgs.append(file_desired_standalone_silent)
                    elif re.match(r'BraveBrowserStandaloneUntagged' +
                                  channel_capitalized + r'Setup32_.*\.exe',
                                  file):
                        filecopy(file_path, file_desired_standalone_untagged)
                        pkgs.append(file_desired_standalone_untagged)
    return pkgs