How to use conan - 10 common examples

To help you get started, we’ve selected a few conan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github conan-io / conan-package-tools / test / app_tests.py View on Github external
def setUp(self):
        self.runner = MockRunner()
        self.packager = ConanMultiPackager("--build missing -r conan.io",
                                           "lasote", "mychannel",
                                           runner=self.runner)
github conan-io / conan-package-tools / test / app_tests.py View on Github external
def testSerialize(self):
        self.packager.add({"os": "Windows", "compiler": "Visual Studio"},
                          {"option1": "value1", "option2": "value2"})

        serial = self.packager.serialize()
        self.assertEquals(serial, '{"username": "lasote", "builds": [[{"os": "Windows", "compiler": "Visual Studio"}, {"option2": "value2", "option1": "value1"}]], "args": "--build missing -r conan.io", "conan_pip_package": null, "channel": "mychannel", "docker_image": null}')
        mp = ConanMultiPackager.deserialize(serial, username="lasote")
        self.assertEqual(mp.conan_pip_package, None)

        self.packager.conan_pip_package = "conan==0.0.1rc7"
        serial = self.packager.serialize()
        mp = ConanMultiPackager.deserialize(serial, username="lasote")
        self.assertEqual(mp.conan_pip_package, "conan==0.0.1rc7")
github nexB / conan / tests / test_docker.py View on Github external
def test_rebuild_rootfs_format_v10(self):
        test_dir = self.extract_test_tar('docker/v10_format/busybox.tgz')
        image = docker.ImageV10(test_dir)
        target_dir = self.get_temp_dir()
        rebuild_rootfs(image, target_dir)
        expected = self.extract_test_tar('docker/v10_format/check_busybox_layer.tar')
        assert testcase.is_same(target_dir, expected)
github nexB / conan / tests / test_docker.py View on Github external
def test_rebuild_rootfs_format_v10_without_repositories_file(self):
        test_dir = self.extract_test_tar('docker/v10_format/busybox_no_repo.tgz')
        image = docker.ImageV10(test_dir)
        target_dir = self.get_temp_dir()
        rebuild_rootfs(image, target_dir)
        expected = self.extract_test_tar('docker/v10_format/check_busybox_layer.tar')
        assert testcase.is_same(target_dir, expected)
github nexB / conan / tests / test_docker.py View on Github external
def test_ImageV10(self):
        test_dir = self.extract_test_tar('docker/v10_format/busybox.tgz')
        docker.ImageV10(test_dir)
github nexB / conan / tests / test_docker.py View on Github external
def test_rebuild_rootfs_format_v10_with_delete(self):
        test_dir = self.extract_test_tar('docker/v10_format/busybox2.tgz')
        image = docker.ImageV10(test_dir)
        target_dir = self.get_temp_dir()
        rebuild_rootfs(image, target_dir)
        expected = [
            '/lib/librt-0.9.33.2.so',
            '/lib/libgcc_s.so.1',
            '/lib/libutil-0.9.33.2.so',
            '/lib/libuClibc-0.9.33.2.so',
            '/lib/libm-0.9.33.2.so',
            '/lib/libresolv-0.9.33.2.so',
            '/lib/libnsl-0.9.33.2.so',
            '/lib/libpthread-0.9.33.2.so'
        ]
        assert sorted(expected) == sorted(f.replace(target_dir, '') for f in fileutils.file_iter(target_dir))
github nexB / conan / tests / test_docker.py View on Github external
def test_rebuild_rootfs_format_v10_with_delete_with_out_of_order_layers(self):
        test_dir = self.extract_test_tar('docker/v10_format/busybox2.tgz')
        image = docker.ImageV10(test_dir)

        # shuffle artificially the layer order
        image.layers = OrderedDict(sorted(image.layers.items()))

        target_dir = self.get_temp_dir()
        try:
            rebuild_rootfs(image, target_dir)
        except InconsistentLayersOderingError:
            pass
github nexB / conan / tests / test_docker.py View on Github external
def test_ImageV10_without_repositories_file(self):
        test_dir = self.extract_test_tar('docker/v10_format/busybox_no_repo.tgz')
        assert docker.ImageV10(test_dir)
github nexB / conan / tests / test_image_v11.py View on Github external
def test_Registry(self):
        Registry('assa')
github nexB / conan / tests / test_image_v11.py View on Github external
def test_flatten(self):
        test_arch = self.get_test_loc('repos/hello-world.tar')
        test_dir = self.extract_test_tar(test_arch)
        expected = os.path.join(self.get_test_loc('repos'), 'hello-world.tar.flatten.expected.json')
        reg = Registry()
        reg.populate(test_dir)
        # ignore the repo_dir and layer_dir that are absolute directories
        result = [{name: value for name, value in layer.items() if not name.endswith('dir')}
                   for layer in reg.flatten()]
        check_expected(result, expected, regen=False)