Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_InstallerContext_get_os_version_type():
from rospkg.os_detect import OS_UBUNTU, OsDetect
from rosdep2.installers import InstallerContext
context = InstallerContext()
try:
context.set_os_version_type(OS_UBUNTU, 'bad')
assert False, 'should check type'
except ValueError:
pass
assert OsDetect.get_version == context.get_os_version_type(OS_UBUNTU)
context.set_os_version_type(OS_UBUNTU, OsDetect.get_codename)
assert OsDetect.get_codename == context.get_os_version_type(OS_UBUNTU)
def test_InstallerContext_get_os_version_type():
from rospkg.os_detect import OS_UBUNTU, OsDetect
from rosdep2.installers import InstallerContext
context = InstallerContext()
try:
context.set_os_version_type(OS_UBUNTU, 'bad')
assert False, 'should check type'
except ValueError:
pass
assert OsDetect.get_version == context.get_os_version_type(OS_UBUNTU)
context.set_os_version_type(OS_UBUNTU, OsDetect.get_codename)
assert OsDetect.get_codename == context.get_os_version_type(OS_UBUNTU)
def test_create_default_installer_context():
import rosdep2
# test both constructors
for context in [rosdep2.create_default_installer_context(), rosdep2.create_default_installer_context(verbose=True)]:
assert context is not None
assert isinstance(context, rosdep2.InstallerContext)
#this is just tripwire as we actual value will change over time
from rospkg.os_detect import OS_UBUNTU, OsDetect
assert OS_UBUNTU in context.get_os_keys()
assert context.get_installer('apt') is not None
assert 'apt' in context.get_os_installer_keys(OS_UBUNTU)
assert OsDetect.get_codename == context.get_os_version_type(OS_UBUNTU)
def register_ubuntu(context):
context.add_os_installer_key(OS_UBUNTU, APT_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, PIP_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, SOURCE_INSTALLER)
context.set_default_os_installer_key(OS_UBUNTU, APT_INSTALLER)
context.set_os_version_type(OS_UBUNTU, TYPE_CODENAME)
def register_linaro(context):
# Linaro is an alias for Ubuntu. If linaro is detected and it's not set as
# an override force ubuntu.
(os_name, os_version) = context.get_os_name_and_version()
if os_name == OS_LINARO and not context.os_override:
print('rosdep detected OS: [%s] aliasing it to: [%s]' %
(OS_LINARO, OS_UBUNTU), file=sys.stderr)
context.set_os_override(OS_UBUNTU, context.os_detect.get_codename())
gbp_repos = gbpdistro_data['repositories']
# Ensure gbp_repos is a dict
if type(gbp_repos) != dict:
raise InvalidData('invalid repo spec in gbpdistro data: ' + str(gbp_repos) +
'. Invalid repositories entry, must be dict.')
for rosdep_key, repo in gbp_repos.items():
if type(repo) != dict:
raise InvalidData('invalid repo spec in gbpdistro data: ' +
str(repo))
for pkg in repo.get('packages', {rosdep_key: None}):
rosdep_data[pkg] = {}
# for pkg in repo['packages']: indent the rest of the lines here.
# Do generation for ubuntu
rosdep_data[pkg][OS_UBUNTU] = {}
# Do generation for empty OS X entries
homebrew_name = '%s/%s/%s' % (get_owner_name(url),
release_name, rosdep_key)
rosdep_data[pkg][OS_OSX] = {
BREW_INSTALLER: {'packages': [homebrew_name]}
}
# - debian package name: underscores must be dashes
deb_package_name = 'ros-%s-%s' % (release_name, pkg)
deb_package_name = deb_package_name.replace('_', '-')
repo_targets = repo['target'] if 'target' in repo else 'all'
if repo_targets == 'all':
repo_targets = target_data
for t in repo_targets:
def register_linaro(context):
# Linaro is an alias for Ubuntu. If linaro is detected and it's not set as
# an override force ubuntu.
(os_name, os_version) = context.get_os_name_and_version()
if os_name == OS_LINARO and not context.os_override:
print('rosdep detected OS: [%s] aliasing it to: [%s]' %
(OS_LINARO, OS_UBUNTU), file=sys.stderr)
context.set_os_override(OS_UBUNTU, context.os_detect.get_codename())
def register_ubuntu(context):
context.add_os_installer_key(OS_UBUNTU, APT_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, PIP_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, SOURCE_INSTALLER)
context.set_default_os_installer_key(OS_UBUNTU, APT_INSTALLER)
context.set_os_version_type(OS_UBUNTU, TYPE_CODENAME)
def register_ubuntu(context):
context.add_os_installer_key(OS_UBUNTU, APT_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, PIP_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, GEM_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, SOURCE_INSTALLER)
context.set_default_os_installer_key(OS_UBUNTU, lambda self: APT_INSTALLER)
context.set_os_version_type(OS_UBUNTU, OsDetect.get_codename)
def register_ubuntu(context):
context.add_os_installer_key(OS_UBUNTU, APT_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, PIP_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, GEM_INSTALLER)
context.add_os_installer_key(OS_UBUNTU, SOURCE_INSTALLER)
context.set_default_os_installer_key(OS_UBUNTU, lambda self: APT_INSTALLER)
context.set_os_version_type(OS_UBUNTU, OsDetect.get_codename)