Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, package, platform='', force=False, checkversion=True):
# Parse version
if '@' in package:
split = package.split('@')
self.package = split[0]
self.version = split[1]
else:
self.package = package
self.version = None
self.force_install = force
self.packages_dir = ''
self.resources = Resources(platform)
if self.package in self.resources.packages:
self.profile = Profile()
dirname = 'packages'
self.packages_dir = util.safe_join(util.get_home_dir(), dirname)
# Get data
data = self.resources.packages.get(self.package)
distribution = self.resources.distribution
self.spec_version = distribution.get('packages').get(self.package)
self.package_name = data.get('release').get('package_name')
self.extension = data.get('release').get('extension')
platform = platform or self._get_platform()
def cli(ctx, packages, all, list, force, platform):
"""Install packages."""
if packages:
for package in packages:
Installer(package, platform, force).install()
elif all: # pragma: no cover
packages = Resources(platform).packages
for package in packages:
Installer(package, platform, force).install()
elif list:
Resources(platform).list_packages(installed=True, notinstalled=True)
else:
click.secho(ctx.get_help())
def cli(ctx, packages, all, list, platform):
"""Uninstall packages."""
if packages:
_uninstall(packages, platform)
elif all: # pragma: no cover
packages = Resources(platform).packages
_uninstall(packages, platform)
elif list:
Resources(platform).list_packages(installed=True, notinstalled=False)
else:
click.secho(ctx.get_help())
def __init__(self):
profile = Profile()
resources = Resources()
self.name = 'system'
self.version = util.get_package_version(self.name, profile)
self.spec_version = util.get_package_spec_version(self.name, resources)
self.ext = ''
if 'Windows' == platform.system():
self.ext = '.exe'
def __init__(self):
profile = Profile()
resources = Resources()
self.name = 'examples'
self.examples_dir = util.get_package_dir(self.name)
self.version = util.get_package_version(self.name, profile)
self.spec_version = util.get_package_spec_version(self.name, resources)
def __init__(self, project_dir=''):
self.profile = Profile()
self.resources = Resources()
if project_dir is not None:
# Move to project dir
project_dir = util.check_dir(project_dir)
os.chdir(project_dir)
def _setup_windows(self):
profile = Profile()
resources = Resources()
self.name = 'drivers'
self.version = util.get_package_version(self.name, profile)
self.spec_version = util.get_package_spec_version(self.name, resources)
def cli(ctx, packages, all, list, force, platform):
"""Install packages."""
if packages:
for package in packages:
Installer(package, platform, force).install()
elif all: # pragma: no cover
packages = Resources(platform).packages
for package in packages:
Installer(package, platform, force).install()
elif list:
Resources(platform).list_packages(installed=True, notinstalled=True)
else:
click.secho(ctx.get_help())
def cli(ctx, packages, all, list, platform):
"""Uninstall packages."""
if packages:
_uninstall(packages, platform)
elif all: # pragma: no cover
packages = Resources(platform).packages
_uninstall(packages, platform)
elif list:
Resources(platform).list_packages(installed=True, notinstalled=False)
else:
click.secho(ctx.get_help())
def cli(ctx, list, fpga):
"""Manage FPGA boards."""
if list:
Resources().list_boards()
elif fpga:
Resources().list_fpgas()
else:
click.secho(ctx.get_help())