(cls, version, build_number=None, latest=False)
return self
Call as either
            CommCareBuild.get_build(version, build_number)
        or
            CommCareBuild.get_build(version, latest=True)
Call as either
            CommCareBuild.get_build(version, build_number)
        or
            CommCareBuild.get_build(version, latest=True)
Call as either CommCareBuild . get_build ( version build_number ) or CommCareBuild . get_build ( version latest = True )
def get_build(cls, version, build_number=None, latest=False):
        """
        Call as either
            CommCareBuild.get_build(version, build_number)
        or
            CommCareBuild.get_build(version, latest=True)
        """

        if latest:
            startkey = [version]
        else:
            build_number = int(build_number)
            startkey = [version, build_number]

        self = cls.view('builds/all',
            startkey=startkey + [{}],
            endkey=startkey,
            descending=True,
            limit=1,
            include_docs=True,
            reduce=False,
        ).one()

        if not self:
            raise KeyError("Can't find build {label}. For instructions on how to add it, see https://github.com/dimagi/commcare-hq/blob/master/corehq/apps/builds/README.md".format(label=BuildSpec(
                version=version,
                build_number=build_number,
                latest=latest
            )))
        return self
def get_build ( cls , version , build_number = None , latest = False ) : if latest : startkey = [ version ] else : build_number = int ( build_number ) startkey = [ version , build_number ] self = cls . view ( 'builds/all' , startkey = startkey + [ { } ] , endkey = startkey , descending = True , limit = 1 , include_docs = True , reduce = False , ) . one ( ) if not self : raise KeyError ( "Can't find build {label}. For instructions on how to add it, see https://github.com/dimagi/commcare-hq/blob/master/corehq/apps/builds/README.md" . format ( label = BuildSpec ( version = version , build_number = build_number , latest = latest ) ) ) return self