Esempio n. 1
0
def devenv(base_dir, platform, **kwargs):
    """
    Set up a development environment.

    Will set up or update the devenv folder as an unpacked extension folder '
    for development.
    """
    if platform == 'edge':
        import buildtools.packagerEdge as packager
    else:
        import buildtools.packagerChrome as packager

    file = StringIO()
    packager.createBuild(base_dir,
                         type=platform,
                         outFile=file,
                         devenv=True,
                         releaseBuild=True)

    from buildtools.packager import getDevEnvPath
    devenv_dir = getDevEnvPath(base_dir, platform)

    shutil.rmtree(devenv_dir, ignore_errors=True)

    file.seek(0)
    with ZipFile(file, 'r') as zip_file:
        zip_file.extractall(devenv_dir)
Esempio n. 2
0
def test_create_build(tmpdir, srcdir):
    out_file = str(tmpdir.join('abp.appx'))
    packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=True)
    appx = zipfile.ZipFile(out_file)

    names = set(appx.namelist())
    assert 'AppxManifest.xml' in names
    assert 'AppxBlockMap.xml' in names
    assert '[Content_Types].xml' in names

    assert 'devbuild-marker' not in appx.read('AppxManifest.xml')
    assert appx.read('Assets/logo_44.png') == '44'
    assert appx.read('Extension/icons/abp-44.png') == '44'
Esempio n. 3
0
def test_create_build(tmpdir, srcdir):
    out_file = str(tmpdir.join('abp.appx'))
    packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=True)
    appx = zipfile.ZipFile(out_file)

    names = set(appx.namelist())
    assert 'AppxManifest.xml' in names
    assert 'AppxBlockMap.xml' in names
    assert '[Content_Types].xml' in names

    assert 'devbuild-marker' not in appx.read('AppxManifest.xml')
    assert appx.read('Assets/logo_44.png') == '44'
    assert appx.read('Extension/icons/abp-44.png') == '44'
def create_build(platform, base_dir, target_path, version, key_file=None):
    """Create a build for the target platform and version."""
    if platform == 'edge':
        import buildtools.packagerEdge as packager
    else:
        import buildtools.packagerChrome as packager

    metadata = readMetadata(base_dir, platform)
    update_metadata(metadata, version)

    build_path = os.path.join(
        target_path,
        getDefaultFileName(metadata, version,
                           get_extension(platform, key_file is not None)),
    )

    packager.createBuild(base_dir, type=platform, outFile=build_path,
                         releaseBuild=True, keyFile=key_file)

    return build_path
Esempio n. 5
0
def build(base_dir, build_num, key_file, release, output_file, platform,
          **kwargs):
    """
    Create a build.

    Creates an extension build with given file name. If output_file is missing
    a default name will be chosen.
    """
    kwargs = {}
    if platform == 'edge':
        import buildtools.packagerEdge as packager
    else:
        import buildtools.packagerChrome as packager

    kwargs['keyFile'] = key_file
    kwargs['outFile'] = output_file
    kwargs['releaseBuild'] = release
    kwargs['buildNum'] = build_num

    packager.createBuild(base_dir, type=platform, **kwargs)
Esempio n. 6
0
def build(base_dir, build_num, key_file, release, output_file, platform,
          **kwargs):
    """
    Create a build.

    Creates an extension build with given file name. If output_file is missing
    a default name will be chosen.
    """
    kwargs = {}
    if platform == 'edge':
        import buildtools.packagerEdge as packager
    else:
        import buildtools.packagerChrome as packager

    kwargs['keyFile'] = key_file
    kwargs['outFile'] = output_file
    kwargs['releaseBuild'] = release
    kwargs['buildNum'] = build_num

    packager.createBuild(base_dir, type=platform, **kwargs)
Esempio n. 7
0
def create_build(platform, base_dir, target_path, version, key_file=None):
    """Create a build for the target platform and version."""
    if platform == 'edge':
        import buildtools.packagerEdge as packager
    else:
        import buildtools.packagerChrome as packager

    metadata = readMetadata(base_dir, platform)
    update_metadata(metadata, version)

    build_path = os.path.join(
        target_path,
        getDefaultFileName(metadata, version,
                           get_extension(platform, key_file is not None)),
    )

    packager.createBuild(base_dir,
                         type=platform,
                         outFile=build_path,
                         releaseBuild=True,
                         keyFile=key_file)

    return build_path
Esempio n. 8
0
def devenv(base_dir, platform, **kwargs):
    """
    Set up a development environment.

    Will set up or update the devenv folder as an unpacked extension folder '
    for development.
    """
    if platform == 'edge':
        import buildtools.packagerEdge as packager
    else:
        import buildtools.packagerChrome as packager

    file = StringIO()
    packager.createBuild(base_dir, type=platform, outFile=file, devenv=True,
                         releaseBuild=True)

    from buildtools.packager import getDevEnvPath
    devenv_dir = getDevEnvPath(base_dir, platform)

    shutil.rmtree(devenv_dir, ignore_errors=True)

    file.seek(0)
    with ZipFile(file, 'r') as zip_file:
        zip_file.extractall(devenv_dir)
Esempio n. 9
0
def test_create_devbuild(tmpdir, srcdir):
    out_file = str(tmpdir.join('abp.appx'))
    packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=False)
    appx = zipfile.ZipFile(out_file)
    assert 'devbuild-marker' in appx.read('AppxManifest.xml')
Esempio n. 10
0
def test_create_devbuild(tmpdir, srcdir):
    out_file = str(tmpdir.join('abp.appx'))
    packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=False)
    appx = zipfile.ZipFile(out_file)
    assert 'devbuild-marker' in appx.read('AppxManifest.xml')