Write the additional information to the MAR header.

        Args:
            productversion (str): product and version string
            channel (str): channel string
187996
def write_additional(self, productversion, channel):
        
        self.fileobj.seek(self.additional_offset)
        extras = extras_header.build(dict(
            count=1,
            sections=[dict(
                channel=six.u(channel),
                productversion=six.u(productversion),
                size=len(channel) + len(productversion) + 2 + 8,
                padding=b'',
            )],
        ))

        self.fileobj.write(extras)
        self.last_offset = self.fileobj.tell()
1070331
def describe(self, version_name):
    
    version_yaml = yaml.safe_dump(self.get_version_details(version_name),
                                  default_flow_style=False)
    print(version_yaml)
498741
def write_version_and_dims(version, dims, f):
    
    f.write(("#" + version + "\n"))
    f.write((dims[0] + "\t" + dims[1] + "\t" + dims[2] + "\t" + dims[3] + "\n"))
291484
function productInformation() {
	var self = {
		dwVersion : new type.UInt32Le(),
        cbCompanyName : new type.UInt32Le(function() {
        	return self.pbCompanyName.size();
        }),
        // may contain "Microsoft Corporation" from server microsoft
        pbCompanyName : new type.BinaryString(new Buffer('Microsoft Corporation', 'ucs2'), { readLength : new type.CallableValue(function() {
        	return self.cbCompanyName.value;
        })}),
        cbProductId : new type.UInt32Le(function() {
        	return self.pbProductId.size();
        }),
        // may contain "A02" from microsoft license server
        pbProductId : new type.BinaryString(new Buffer('A02', 'ucs2'), { readLength : new type.CallableValue(function() {
        	return self.cbProductId.value;
        })})
	};
	
	return new type.Component(self);
}
319096
def version
      send_message!(Protocol::Device::GetVersion.new,
         wait_for: Protocol::Device::StateVersion) do |payload|
        {
          vendor: payload.vendor,
          product: payload.product,
          version: payload.version
        }
      end
    end
1101745
def increment_version(version):
    

    parts = [int(v) for v in version.split('.')]
    parts[-1] += 1
    parts.append('dev0')

    return '.'.join(map(str, parts))
514234
def version(self):
        
        if self.find:
            return self.meta.sp + split_package(self.find)[1]
        return ""
1079679
def _do_info(bz, opt):
    
    # All these commands call getproducts internally, so do it up front
    # with minimal include_fields for speed
    def _filter_components(compdetails):
        ret = {}
        for k, v in compdetails.items():
            if v.get("is_active", True):
                ret[k] = v
        return ret

    productname = (opt.components or opt.component_owners or opt.versions)
    include_fields = ["name", "id"]
    fastcomponents = (opt.components and not opt.active_components)
    if opt.versions:
        include_fields += ["versions"]
    if opt.component_owners:
        include_fields += [
            "components.default_assigned_to",
            "components.name",
        ]
    if (opt.active_components and
        any(["components" in i for i in include_fields])):
        include_fields += ["components.is_active"]

    bz.refresh_products(names=productname and [productname] or None,
            include_fields=include_fields)

    if opt.products:
        for name in sorted([p["name"] for p in bz.getproducts()]):
            print(name)

    elif fastcomponents:
        for name in sorted(bz.getcomponents(productname)):
            print(name)

    elif opt.components:
        details = bz.getcomponentsdetails(productname)
        for name in sorted(_filter_components(details)):
            print(name)

    elif opt.versions:
        proddict = bz.getproducts()[0]
        for v in proddict['versions']:
            print(to_encoding(v["name"]))

    elif opt.component_owners:
        details = bz.getcomponentsdetails(productname)
        for c in sorted(_filter_components(details)):
            print(to_encoding(u"%s: %s" % (c,
                details[c]['default_assigned_to'])))
167913
def update_product_version(id, **kwargs):
    
    content = update_product_version_raw(id, **kwargs)
    if content:
        return utils.format_json(content)
952609
def write_release_version(version):
    """"""
    dirname = os.path.abspath(os.path.dirname(__file__))
    f = open(os.path.join(dirname, "_version.py"), "wt")
    f.write("__version__ = '%s'\n" % version)
    f.close()
780773
def _make_version(major, minor, micro, releaselevel, serial):
    """"""
    assert releaselevel in ['alpha', 'beta', 'candidate', 'final']
    version = "%d.%d" % (major, minor)
    if micro:
        version += ".%d" % (micro,)
    if releaselevel != 'final':
        short = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc'}[releaselevel]
        version += "%s%d" % (short, serial)
    return version
895607
def bump_version(ctx, new_version, version_part=None, dry_run=False):
    """"""
    version_part = version_part or "minor"
    if dry_run:
        ctx = DryRunContext(ctx)
    ctx.run("bumpversion --new-version={} {}".format(new_version,
                                                      version_part))
1279721
def bump_version(v: version.Version, level: str) -> str:
    """"""
    release: List[int] = list(v.release)
    stage: Optional[str]
    pre: Optional[int]
    stage, pre = v.pre if v.pre else (None, None)
    dev: Optional[int] = v.dev
    post: Optional[int] = v.post

    if level in ("major", "minor", "patch"):
        segments = 0
        if level == "major":
            # if the version code is in format of x.0.0, and pre/dev is not empty
            # do not increase the version number
            segments = 1
        elif level == "minor":
            # if the version code is in format of x.x.0, and pre/dev is not empty
            # do not increase the version number
            segments = 2
        elif level == "patch":
            # if the version code is in format of x.x.x, and pre/dev is not empty
            # do not increase the version number
            segments = 3
        if not any(release[segments:]) and (stage is not None or dev is not None):
            pass
        else:
            release[segments - 1] += 1
        release[segments:] = [0] * max(len(release) - segments, 0)
        stage = pre = post = dev = None
    elif level == "alpha":
        if stage is None:
            if dev is None:
                release[-1] += 1
            stage, pre = "a", 1
        elif stage > "a":
            release[-1] += 1
            stage, pre = "a", 1
        elif stage == "a":
            pre += 1
        post = dev = None
    elif level == "beta":
        if stage is None:
            if dev is None:
                release[-1] += 1
            stage, pre = "b", 1
        elif stage > "b":
            release[-1] += 1
            stage, pre = "b", 1
        elif stage == "b":
            pre += 1
        elif stage < "b":
            pre = 1
            stage = "b"
        post = dev = None
    elif level == "post":
        if post is not None:
            post += 1
        else:
            post = 1
        dev = None
    elif level == "dev":
        if dev is not None:
            dev += 1
        else:
            if stage:
                pre += 1
            else:
                release[-1] += 1
            dev = 1

    ver = ".".join(str(i) for i in release)
    if stage is not None:
        ver += f"{stage}{pre}"
    if post is not None:
        ver += f".post{post}"
    if dev is not None:
        ver += f".dev{dev}"

    return ver
285428
def _write_header(f, version, flags, stream_id, opcode, length):
        
        pack = v3_header_pack if version >= 3 else header_pack
        f.write(pack(version, flags, stream_id, opcode))
        write_int(f, length)
1093845
def write_to(self, f, version = None):
        
        if not version:
            version = self.version
        if version == 1:
            header = "%(url)s %(ip_address)s %(date)s %(content_type)s %(length)s"
        elif version == 2:
            header = "%(url)s %(ip_address)s %(date)s %(content_type)s %(result_code)s %(checksum)s %(location)s %(offset)s %(filename)s %(length)s"

        header =  header%dict(url          = self['url'],
                              ip_address   = self['ip_address'],
                              date         = self['date'],
                              content_type = self['content_type'],
                              result_code  = self['result_code'],
                              checksum     = self['checksum'],
                              location     = self['location'],
                              offset       = self['offset'],
                              filename     = self['filename'],
                              length       = self['length'])
        f.write(header)
362089
def write(self, version):
        
        with tempfile.NamedTemporaryFile(mode='w', delete=False) as fh:
            fh.write(str(version))

        if self._path.exists():
            shutil.copystat(str(self._path), fh.name)

        try:
            pathlib.Path(fh.name).rename(self._path)
        except OSError as exc:
            # handling situation with tmp file on another device
            if exc.errno == 18 and 'Invalid cross-device link' in exc.strerror:
                with self._path.open(mode='w') as fh:
                    fh.write(str(version))
            else:
                raise
677090
def _version_header(self):
        """"""
        if not self._cached_version_header:
            self._cached_version_header = urlparse.urlencode(
                self._version_values())
        return self._cached_version_header