def setup_dirs(): """ Ensure that snapcraft.common plugindir is setup correctly and support running out of a development snapshot """ from snapcraft.internal import common topdir = os.path.abspath(os.path.join(__file__, '..', '..', '..')) # only change the default if we are running from a checkout if os.path.exists(os.path.join(topdir, 'setup.py')): common.set_plugindir(os.path.join(topdir, 'snapcraft', 'plugins')) common.set_schemadir(os.path.join(topdir, 'schema')) common.set_librariesdir(os.path.join(topdir, 'libraries')) common.set_tourdir(os.path.join(topdir, 'tour'))
def setup_dirs(): """ Ensure that snapcraft.common plugindir is setup correctly and support running out of a development snapshot """ from snapcraft.internal import common topdir = os.path.abspath(os.path.join(__file__, "..", "..", "..")) # only change the default if we are running from a checkout if os.path.exists(os.path.join(topdir, "setup.py")): common.set_plugindir(os.path.join(topdir, "snapcraft", "plugins")) common.set_schemadir(os.path.join(topdir, "schema")) common.set_librariesdir(os.path.join(topdir, "libraries")) common.set_tourdir(os.path.join(topdir, "tour"))
def test_set_tourdir(self): tourdir = os.path.join(self.path, 'testtour') common.set_tourdir(tourdir) self.assertEqual(tourdir, common.get_tourdir())
def test_set_tourdir(self): self.skipTest("This test is Failing in the launchpad builders. " "Skipping while we find the reason.") tourdir = os.path.join(self.path, "testtour") common.set_tourdir(tourdir) self.assertEqual(tourdir, common.get_tourdir())
_mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG def dict_representer(dumper, data): return dumper.represent_dict(data.items()) def dict_constructor(loader, node): # Necessary in order to make yaml merge tags work loader.flatten_mapping(node) return OrderedDict(loader.construct_pairs(node)) def str_presenter(dumper, data): if len(data.splitlines()) > 1: # check for multiline string return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|') return dumper.represent_scalar('tag:yaml.org,2002:str', data) yaml.add_representer(str, str_presenter) yaml.add_representer(OrderedDict, dict_representer) yaml.add_constructor(_mapping_tag, dict_constructor) from snapcraft.internal import common as _common # noqa if _common.is_snap(): snap = _os.environ.get('SNAP') _common.set_schemadir(_os.path.join(snap, 'share', 'snapcraft', 'schema')) _common.set_tourdir(_os.path.join(snap, 'tour'))