Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def cli(ctx, lsftdi, lsusb, lsserial, info):
"""System tools.\n
Install with `apio install system`"""
exit_code = 0
if lsftdi:
exit_code = System().lsftdi()
elif lsusb:
exit_code = System().lsusb()
elif lsserial:
exit_code = System().lsserial()
elif info:
click.secho('Platform: ', nl=False)
click.secho(get_systype(), fg='yellow')
else:
click.secho(ctx.get_help())
ctx.exit(exit_code)
def _get_version(self):
releases = api_request('tools-usb-ftdi/releases/latest')
if releases is not None and 'tag_name' in releases:
version = releases['tag_name'].split('.')[1] # v0.X -> X
return version
def _get_version(self):
releases = api_request('Platformio-FPGA/releases/latest')
if releases is not None and 'tag_name' in releases:
version = releases['tag_name'].split('.')[1] # 0.X -> X
return version
def _get_version(self):
releases = api_request('toolchain-icestorm/releases/latest')
if releases is not None and 'tag_name' in releases:
version = releases['tag_name'].split('.')[1] # 0.X -> X
return version
def _get_version(self):
releases = api_request('toolchain-iverilog/releases/latest')
if releases is not None and 'tag_name' in releases:
version = releases['tag_name'].split('.')[1] # v0.X -> X
return version
def _get_valid_version(self, rel_name, organization, tag_name):
# Download latest releases list
releases = api_request('{}/releases'.format(rel_name), organization)
if self.version:
# Find required version via @
if not util.check_package_version(self.version, self.spec_version):
util.show_package_version_warning(
self.package, self.version, self.spec_version)
exit(1)
return self._find_required_version(
releases, tag_name, self.version, self.spec_version)
else:
# Find latest version release
return self._find_latest_version(
releases, tag_name, self.spec_version)
default.update(kwargs)
kwargs = default
try:
p = subprocess.Popen(*args, **kwargs)
result['out'], result['err'] = p.communicate()
result['returncode'] = p.returncode
except KeyboardInterrupt:
click.secho('Aborted by user', fg='red')
exit(1)
except Exception as e:
click.secho(str(e), fg='red')
exit(1)
finally:
for s in ('stdout', 'stderr'):
if isinstance(kwargs[s], AsyncPipe):
kwargs[s].close()
_parse_result(kwargs, result)
return result
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, lsftdi, lsusb, lsserial, info):
"""System tools.\n
Install with `apio install system`"""
exit_code = 0
if lsftdi:
exit_code = System().lsftdi()
elif lsusb:
exit_code = System().lsusb()
elif lsserial:
exit_code = System().lsserial()
elif info:
click.secho('Platform: ', nl=False)
click.secho(get_systype(), fg='yellow')
else:
click.secho(ctx.get_help())
ctx.exit(exit_code)
def cli(ctx, lsftdi, lsusb, lsserial, info):
"""System tools.\n
Install with `apio install system`"""
exit_code = 0
if lsftdi:
exit_code = System().lsftdi()
elif lsusb:
exit_code = System().lsusb()
elif lsserial:
exit_code = System().lsserial()
elif info:
click.secho('Platform: ', nl=False)
click.secho(get_systype(), fg='yellow')
else:
click.secho(ctx.get_help())
ctx.exit(exit_code)