Download & install a license for your CDRouter system from the
        CDRouter Support Lounge.

        :return: :class:`system.Upgrade <system.Upgrade>` object
        :rtype: system.Upgrade
422606
def lounge_update_license(self):
        
        schema = UpgradeSchema()
        resp = self.service.post(self.base+'license/')
        return self.service.decode(schema, resp)
866687
def upgrade_available(name, **kwargs):
    '''
    
    '''
    version = None
    cmd = ['pkg', 'list', '-Huv', name]
    lines = __salt__['cmd.run_stdout'](cmd).splitlines()
    if not lines:
        return {}
    ret = {}
    for line in lines:
        ret[_ips_get_pkgname(line)] = _ips_get_pkgversion(line)
    return ret
1209357
def install():
    
    _version_re = re.compile(r"__version__\s+=\s+(.*)")  # pylint: disable=invalid-name

    with open('./fleaker/__init__.py', 'rb') as file_:
        version = ast.literal_eval(_version_re.search(  # pylint: disable=invalid-name
            file_.read().decode('utf-8')).group(1))

    download_url = ('https://github.com/croscon/fleaker/archive/'
                    'v{}.tar.gz'.format(version))

    setup(
        name='fleaker',
        version=version,
        download_url=download_url,
        description='Tools and extensions to make Flask development easier.',
        url='https://github.com/croscon/fleaker',
        author='Croscon Consulting',
        author_email='open.source@croscon.com',
        license='BSD',
        packages=[
            'fleaker',
            'fleaker.marshmallow',
            'fleaker.marshmallow.fields',
            'fleaker.peewee',
            'fleaker.peewee.fields',
            'fleaker.peewee.mixins',
            'fleaker.peewee.mixins.time',
        ],
        zip_safe=False,
        long_description=__doc__,
        include_package_data=True,
        platforms='any',
        install_requires=[
            'Flask',
            'Flask-Classful',
            'Flask-Login',
            'Flask-Marshmallow',
            'arrow',
            'bcrypt',
            'blinker',
            'marshmallow',
            'marshmallow-jsonschema',
            'peewee',
            'pendulum',
            'phonenumbers',
            'simplejson',
        ],
        classifiers=[
            'Development Status :: 2 - Pre-Alpha',
            'Environment :: Web Environment',
            'Framework :: Flask',
            'Intended Audience :: Developers',
            'License :: OSI Approved :: BSD License',
            'Operating System :: OS Independent',
            'Programming Language :: Python',
            # @TODO: Pick specific Python versions; out of the gate flask does 2.6,
            # 2.7, 3.3, 3.4, and 3.5
            'Programming Language :: Python :: 2',
            'Programming Language :: Python :: 3',
            'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
            'Topic :: Software Development :: Libraries :: Application Frameworks',
            'Topic :: Software Development :: Libraries :: Python Modules',
        ],
        keywords=['flask', 'web development', 'flask extension']
    )
1366222
def upgrade():
    """"""
    op.create_table(
        'pidstore_pid',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('pid_type', sa.String(length=6), nullable=False),
        sa.Column('pid_value', sa.String(length=255), nullable=False),
        sa.Column('pid_provider', sa.String(length=8), nullable=True),
        sa.Column('status', sa.CHAR(1), nullable=False),
        sa.Column('object_type', sa.String(length=3), nullable=True),
        sa.Column(
            'object_uuid',
            sqlalchemy_utils.types.uuid.UUIDType(),
            nullable=True
        ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_index(
        'idx_object', 'pidstore_pid', ['object_type', 'object_uuid'],
        unique=False
    )
    op.create_index('idx_status', 'pidstore_pid', ['status'], unique=False)
    op.create_index(
        'uidx_type_pid', 'pidstore_pid', ['pid_type', 'pid_value'],
        unique=True
    )
    op.create_table(
        'pidstore_recid',
        sa.Column('recid', sa.BigInteger(), nullable=False),
        sa.PrimaryKeyConstraint('recid')
    )
    op.create_table(
        'pidstore_redirect',
        sa.Column('created', sa.DateTime(), nullable=False),
        sa.Column('updated', sa.DateTime(), nullable=False),
        sa.Column(
            'id',
            sqlalchemy_utils.types.uuid.UUIDType(),
            nullable=False
        ),
        sa.Column('pid_id', sa.Integer(), nullable=False),
        sa.ForeignKeyConstraint(
            ['pid_id'],
            [u'pidstore_pid.id'],
            onupdate='CASCADE',
            ondelete='RESTRICT'
        ),
        sa.PrimaryKeyConstraint('id')
    )
1093500
def download_and_install_dependencies():
    

    try:
        import requests
    except ImportError:
        raise ValueError("Python 3.6+ is required.")

    dependencies = {"hmm_databases": HMM_URL}

    if sys.platform.startswith("linux") or "bsd" in sys.platform:

        dependencies["prodigal"] = "{}.linux".format(BASE_PRODIGAL)
        dependencies["louvain"] = (
            "https://lip6.github.io/Louvain-BinaryBuild/"
            "louvain_linux.tar.gz"
        )
    elif sys.platform == "darwin":

        dependencies["prodigal"] = "{}.osx.10.9.5".format(BASE_PRODIGAL)
        dependencies["louvain"] = (
            "https://github.com/lip6/Louvain-BinaryBuilds/raw/osx/"
            "louvain_osx.tar.gz"
        )
    elif sys.platform.startswith("win") or sys.platform == "cygwin":

        dependencies["prodigal"] = "{}.windows.exe"
        dependencies["louvain"] = (
            "https://ci.appveyor.com/api/projects/yanntm/"
            "Louvain-BinaryBuild/artifacts/website/"
            "louvain_windows.tar.gz"
        )

    else:
        raise NotImplementedError(
            "Your platform is not supported: {}".format(sys.platform)
        )

    cache_dir = pathlib.Path.cwd() / pathlib.Path("cache")

    try:
        print("Downloading dependencies...")
        cache_dir.mkdir()
        for dependency_name, url in dependencies.items():
            print("Downloading {} at {}".format(dependency_name, url))
            request = requests.get(url)
            basename = url.split("/")[-1]

            with open(cache_dir / basename, "wb") as handle:
                print(dependency_name, basename, cache_dir / basename)
                handle.write(request.content)
    except FileExistsError:
        print("Using cached dependencies...")

    share_dir = pathlib.Path.cwd()
    tools_dir = share_dir / "tools"
    louvain_dir = tools_dir / "louvain"

    louvain_dir.mkdir(parents=True, exist_ok=True)

    louvain_basename = dependencies["louvain"].split("/")[-1]
    louvain_path = louvain_dir / louvain_basename
    (cache_dir / louvain_basename).replace(louvain_path)

    with tarfile.open(louvain_path, "r:gz") as tar:
        tar.extractall()

    hmm_basename = dependencies["hmm_databases"].split("/")[-1]
    hmm_path = share_dir / hmm_basename
    (cache_dir / hmm_basename).replace(hmm_path)

    prodigal_basename = dependencies["prodigal"].split("/")[-1]
    prodigal_path = tools_dir / "prodigal"
    (cache_dir / prodigal_basename).replace(prodigal_path)
374863
def upgrade(directory, sql, tag, x_arg, revision):
    """"""
    _upgrade(directory, revision, sql, tag, x_arg)
917329
def install(self, to, chmod=0644):
        
        self.copy(to)
        path(to).chmod(chmod)
465812
def update_license(self, license_text):
    
    content = (
        '--MULTI_BOUNDARY',
        'Content-Disposition: form-data; name="license"',
        '',
        license_text,
        '--MULTI_BOUNDARY--',
        '')
    resp = self._get_resource_root().post('cm/license',
        data="\r\n".join(content),
        contenttype='multipart/form-data; boundary=MULTI_BOUNDARY')
    return ApiLicense.from_json_dict(resp, self._get_resource_root())
54210
def bin_upgrade(self):
        
        packages = self.args[1:]
        options = [
            "-u",
            "--upgradepkg"
        ]
        flag = ""
        flags = [
            "--dry-run",
            "--install-new",
            "--reinstall",
            "--verbose"
        ]
        if len(self.args) > 1 and self.args[0] in options:
            if self.args[1] in flags:
                flag = self.args[1]
                packages = self.args[2:]
            PackageManager(packages).upgrade(flag)
        else:
            usage("")
786353
def install(self):
        
        binary = slack_package(self.prgnam)
        print("[ {0}Installing{1} ] --> {2}".format(self.green, self.endc,
                                                    self.name))
        PackageManager(binary).upgrade(flag="--install-new")
561896
def upgradestep(upgrade_product, version):
    
    def wrap_func(fn):
        def wrap_func_args(context, *args):
            p = getToolByName(context, 'portal_quickinstaller').get(upgrade_product)
            setattr(p, 'installedversion', version)
            return fn(context, *args)
        return wrap_func_args
    return wrap_func
477954
def licenseFile(self):
        
        if self._licenseFile:
            return self._licenseFile
        elif self._license:
            f = projex.resources.find('licenses/{0}.txt'.format(self.license()))
            return f
        else:
            return ''
492519
def upgrade_addons_operation(self, addons_state, mode=None):
        
        installed = set(a.name for a in addons_state
                        if a.state in ('installed', 'to upgrade'))

        base_mode = self._get_version_mode()
        addons_list = base_mode.upgrade_addons.copy()
        if mode:
            add_mode = self._get_version_mode(mode=mode)
            addons_list |= add_mode.upgrade_addons

        to_install = addons_list - installed
        to_upgrade = installed & addons_list

        return UpgradeAddonsOperation(self.options, to_install, to_upgrade)
17382
def licenses(self):
        
        if not self.__licenses:
            self.__licenses = Licenses(self.__connection)
        return self.__licenses
1014247
def install(self, update=False):
        
        offline = self.offline or update
        self.create_env(offline)
        self.install_pkgs(offline)
        self.install_pip(offline)
        return tuple()
441319
def upgrade_available(pkg,
                      bin_env=None,
                      user=None,
                      cwd=None):
    '''
    
    '''
    return pkg in list_upgrades(bin_env=bin_env, user=user, cwd=cwd)
1284507
def download_if_not_exists(url: str, filename: str,
                           skip_cert_verify: bool = True,
                           mkdir: bool = True) -> None:
    
    if os.path.isfile(filename):
        log.info("No need to download, already have: {}", filename)
        return
    if mkdir:
        directory, basename = os.path.split(os.path.abspath(filename))
        mkdir_p(directory)
    download(url=url,
             filename=filename,
             skip_cert_verify=skip_cert_verify)