예제 #1
0
 def parent_directory_test(self):
     files_dest = ["file.txt", "subdir2/file2.txt"]
     self._save(self.dest, files_dest, "fromdest")
     self.source = join(self.dest, "source_folder")
     files = ["file.txt", "subdir/file2.txt"]
     self._save(self.source, files, "fromsrc")
     merge_directories(self.source, self.dest)
     shutil.rmtree(self.source)
     self._assert_equals(self._get_paths(self.dest), files + files_dest)
     self.assertEquals(load(join(self.dest, "file.txt")), "fromsrc")
     self.assertEquals(load(join(self.dest, "subdir2/file2.txt")), "fromdest")
     self.assertEquals(load(join(self.dest, "subdir/file2.txt")), "fromsrc")
예제 #2
0
    def test_revisions_packages_download(self):
        conanfile = '''
import os
from conans import ConanFile, tools

class HelloConan(ConanFile):
    
    def build(self):
        tools.save("myfile.txt", os.getenv("PACKAGE_CONTENTS"))
        
    def package(self):
        self.copy("*")
'''
        with environment_append({"PACKAGE_CONTENTS": "1"}):
            self._create_and_upload(conanfile, self.ref)
        rev = self.servers["remote0"].paths.get_last_revision(self.ref).revision
        self.assertEquals(rev, "202f9ce41808083a0f0c0d071fb5f398")

        self.ref = self.ref.copy_with_rev(rev)
        p_ref = PackageReference(self.ref, "5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9")
        pkg_rev = self.servers["remote0"].paths.get_last_package_revision(p_ref).revision
        self.assertEquals(pkg_rev, "15ab113a16e2ac8c9ecffb4ba48306b2")

        # Create new package revision for the same recipe
        with environment_append({"PACKAGE_CONTENTS": "2"}):
            self._create_and_upload(conanfile, self.ref.copy_clear_rev())
        pkg_rev = self.servers["remote0"].paths.get_last_package_revision(p_ref).revision
        self.assertEquals(pkg_rev, "8e54c6ea967722f2f9bdcbacb21792f5")

        # Delete all from local
        self.client.run("remove %s -f" % str(self.ref.copy_clear_rev()))

        # Download specifying recipe with revisions and package with revisions
        self.client.run("download %s -p 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9#"
                        "8e54c6ea967722f2f9bdcbacb21792f5" % self.ref.full_repr())

        contents = load(os.path.join(self.client.paths.package(p_ref), "myfile.txt"))
        self.assertEquals(contents, "2")

        # Download previous package revision
        self.client.run("download %s -p 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9#"
                        "15ab113a16e2ac8c9ecffb4ba48306b2" % self.ref.full_repr())
        contents = load(os.path.join(self.client.paths.package(p_ref), "myfile.txt"))
        self.assertEquals(contents, "1")

        # Specify a package revision without a recipe revision
        error = self.client.run("download %s -p 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9#"
                                "15ab113a16e2ac8c9ecffb4ba48306b2" % str(self.ref),
                                ignore_error=True)
        self.assertTrue(error)
        self.assertIn("It is needed to specify the recipe revision if "
                      "you specify a package revision", self.client.out)
예제 #3
0
    def environment_deactivate_test(self):

        in_windows = platform.system() == "Windows"
        env_cmd = "set" if in_windows else "env"
        extension = "bat" if in_windows else "sh"

        def env_output_to_dict(env_output):
            env = {}
            for line in env_output.splitlines():
                tmp = line.split("=")
                # OLDPWD is cleared when a child script is started
                if tmp[0] not in ["SHLVL", "_", "PS1", "OLDPWD"]:
                    env[tmp[0]] = tmp[1].replace("\\", "/")
            return env

        def get_cmd(script_name):
            if in_windows:
                return "%s && set" % script_name
            else:
                return "bash -c 'source %s && env'" % script_name

        conanfile = """
from conans import ConanFile

class TestConan(ConanFile):
    name = "test"
    version = "1.0"
    settings = "os", "compiler", "arch", "build_type"
    generators = "virtualbuildenv"
"""
        client = TestClient(path_with_spaces=False)
        client.save({"conanfile.py": conanfile})
        client.run("install .")
        output = check_output(env_cmd)
        normal_environment = env_output_to_dict(output)
        client.run("install .")
        act_build_file = os.path.join(client.current_folder,
                                      "activate_build.%s" % extension)
        deact_build_file = os.path.join(client.current_folder,
                                        "deactivate_build.%s" % extension)
        self.assertTrue(os.path.exists(act_build_file))
        self.assertTrue(os.path.exists(deact_build_file))
        if in_windows:
            act_build_content_len = len(load(act_build_file).splitlines())
            deact_build_content_len = len(load(deact_build_file).splitlines())
            self.assertEqual(act_build_content_len, deact_build_content_len)
        output = check_output(get_cmd(act_build_file))
        activate_environment = env_output_to_dict(output)
        self.assertNotEqual(normal_environment, activate_environment)
        output = check_output(get_cmd(deact_build_file))
        deactivate_environment = env_output_to_dict(output)
        self.assertEqual(normal_environment, deactivate_environment)
예제 #4
0
    def nested_directories_test(self):
        self.dest = join(self.source, "destination_dir")
        files_dest = ["file.txt", "subdir2/file2.txt"]
        self._save(self.dest, files_dest, "fromdest")
        mkdir(join(self.dest, "empty_folder", "subempty_folder"))

        files = ["file.txt", "subdir/file2.txt"]
        self._save(self.source, files, "fromsrc")

        merge_directories(self.source, self.dest)
        self._assert_equals(self._get_paths(self.dest), files + files_dest +
                            ['empty_folder/subempty_folder', ])
        self.assertEquals(load(join(self.dest, "file.txt")), "fromsrc")
        self.assertEquals(load(join(self.dest, "subdir2/file2.txt")), "fromdest")
        self.assertEquals(load(join(self.dest, "subdir/file2.txt")), "fromsrc")
예제 #5
0
def _load_configs(configs_file):
    try:
        configs = json.loads(load(configs_file))
    except Exception as e:
        raise ConanException("Error loading configs-install file: %s\n%s" %
                             (configs_file, str(e)))
    return [_ConfigOrigin(config) for config in configs]
예제 #6
0
    def tune_conan_conf(self, base_folder, cpu_count, revisions_enabled):
        # Create the default
        self.cache.config

        if cpu_count:
            replace_in_file(self.cache.conan_conf_path,
                            "# cpu_count = 1",
                            "cpu_count = %s" % cpu_count,
                            output=TestBufferConanOutput(),
                            strict=not bool(base_folder))

        current_conf = load(self.cache.conan_conf_path)
        if "revisions_enabled" in current_conf:  # Invalidate any previous value to be sure
            replace_in_file(self.cache.conan_conf_path,
                            "revisions_enabled",
                            "#revisions_enabled",
                            output=TestBufferConanOutput())
        if revisions_enabled:
            replace_in_file(self.cache.conan_conf_path,
                            "[general]",
                            "[general]\nrevisions_enabled = 1",
                            output=TestBufferConanOutput())

        # Invalidate the cached config
        self.cache.invalidate()
    def content(self):
        files = {}


        for package in self.deps_build_info.deps:
            package_name = transform_name(package)
            package_dir = os.path.join(self.root_dir, package_name)

            modules = []

            if len(self.deps_build_info[package].components) > 0:
                for component in self.deps_build_info[package].components:
                    component_name = transform_name(component)
                    component_dir = os.path.join(package_dir, "Source", component_name)
                    files[os.path.join(component_dir, component_name + ".Build.cs")] = self.generate_module_file(component_name, self.deps_build_info[package].components)
                    modules.append(component_name)

            else:
                component_name = package_name
                component_dir = os.path.join(package_dir, "Source", component_name)
                files[os.path.join(component_dir, component_name + ".Build.cs")] = self.generate_module_file(component_name, self.deps_build_info[package])
                modules.append(component_name)

            plugin_file = load(os.path.join(os.path.dirname(__file__), "templates", "Plugin.uplugin"))
            plugin_file = plugin_file.replace("{name}", package_name)
            plugin_file = plugin_file.replace("{version}", self.deps_build_info[package].version)
            files[os.path.join(package_dir, package_name + ".uplugin")] = plugin_file

        return files
예제 #8
0
파일: search.py 프로젝트: wjt2015/conan
def _get_local_infos_min(server_store, ref, look_in_all_rrevs):

    result = {}
    rrevs = server_store.get_recipe_revisions(ref) if look_in_all_rrevs else [
        None
    ]

    for rrev in rrevs:
        new_ref = ref.copy_with_rev(rrev.revision) if rrev else ref
        subdirs = list_folder_subdirs(server_store.packages(new_ref), level=1)
        for package_id in subdirs:
            if package_id in result:
                continue
            # Read conaninfo
            try:
                pref = PackageReference(new_ref, package_id)
                revision_entry = server_store.get_last_package_revision(pref)
                if not revision_entry:
                    raise NotFoundException("")
                pref = PackageReference(new_ref, package_id,
                                        revision_entry.revision)
                info_path = os.path.join(server_store.package(pref), CONANINFO)
                if not os.path.exists(info_path):
                    raise NotFoundException("")
                conan_info_content = load(info_path)
                info = ConanInfo.loads(conan_info_content)
                conan_vars_info = info.serialize_min()
                result[package_id] = conan_vars_info
            except Exception as exc:  # FIXME: Too wide
                logger.error("Package %s has no ConanInfo file" % str(pref))
                if str(exc):
                    logger.error(str(exc))
    return result
예제 #9
0
def _get_local_infos_min(paths, reference, v2_compatibility_mode=False):

    result = {}

    if not reference.revision and v2_compatibility_mode:
        recipe_revisions = paths.get_recipe_revisions(reference)
    else:
        recipe_revisions = [reference]

    for recipe_revision in recipe_revisions:
        packages_path = paths.packages(recipe_revision)
        subdirs = list_folder_subdirs(packages_path, level=1)
        for package_id in subdirs:
            if package_id in result:
                continue
            # Read conaninfo
            try:
                package_reference = PackageReference(reference, package_id)
                info_path = os.path.join(paths.package(package_reference,
                                                       short_paths=None), CONANINFO)
                if not os.path.exists(info_path):
                    raise NotFoundException("")
                conan_info_content = load(info_path)
                info = ConanInfo.loads(conan_info_content)
                conan_vars_info = info.serialize_min()
                result[package_id] = conan_vars_info

            except Exception as exc:
                logger.error("Package %s has no ConanInfo file" % str(package_reference))
                if str(exc):
                    logger.error(str(exc))
    return result
예제 #10
0
파일: tools.py 프로젝트: yfxu1990/conan
 def search(self, pattern, remote=None, assert_error=False, args=None):
     remote = " -r={}".format(remote) if remote else ""
     self.run("search {} --json {} {} {}".format(pattern, self.tmp_json_name, remote,
                                                 args or ""),
              assert_error=assert_error)
     json_path = os.path.join(self.current_folder, self.tmp_json_name)
     data = json.loads(load(json_path))
     return data
예제 #11
0
 def test_generate_basic_setup_debug_32bit(self):
     self.client.run(
         "install . -s build_type=Debug -s arch=x86 --build missing")
     self.client.run_command("premake5 vs2017")
     sln_content = load(
         os.path.join(self.client.current_folder, "example.sln"))
     self.assertIn("Debug|Win32", sln_content)
     self.assertNotIn("Release|Win32", sln_content)
     self.assertNotIn("Release|x64", sln_content)
예제 #12
0
파일: tools.py 프로젝트: yfxu1990/conan
    def _set_revisions(self, value):
        current_conf = load(self.cache.conan_conf_path)
        if "revisions_enabled" in current_conf:  # Invalidate any previous value to be sure
            replace_in_file(self.cache.conan_conf_path, "revisions_enabled", "#revisions_enabled",
                            output=TestBufferConanOutput())

        replace_in_file(self.cache.conan_conf_path,
                        "[general]", "[general]\nrevisions_enabled = %s" % value,
                        output=TestBufferConanOutput())
예제 #13
0
 def test_generate_basic_setup_release(self):
     self.client.run(
         "install . -s build_type=Release -s arch=x86_64 --build missing")
     with chdir(self.client.current_folder):
         self.client.runner("premake5 vs2017")
     sln_content = load(
         os.path.join(self.client.current_folder, "example.sln"))
     self.assertIn("Release|x64", sln_content)
     self.assertNotIn("Debug|Win32", sln_content)
     self.assertNotIn("Debug|x64", sln_content)
예제 #14
0
 def deploy_manifest_content_test(self):
     base_path = os.path.join(self.client.current_folder, "name")
     header_path = os.path.join(base_path, "include", "header.h")
     lib_path = os.path.join(base_path, "my_libs", "file.lib")
     config_path = os.path.join(base_path, "file.config")
     manifest_path = os.path.join(self.client.current_folder, "deploy_manifest.txt")
     content = load(manifest_path)
     self.assertIn(header_path, content)
     self.assertIn(lib_path, content)
     self.assertIn(config_path, content)
예제 #15
0
    def no_error_with_no_method_test(self):
        hook_manager, output, hook_path = self._init()
        other_hook = """
def my_custom_function():
    pass
"""
        save(hook_path, other_hook)
        self.assertEqual(other_hook, load(hook_path))
        hook_manager.execute("pre_source")
        self.assertEqual("", output)
예제 #16
0
    def no_error_with_no_method_test(self):
        plugin_manager, output, plugin_path = self._init()
        other_plugin = """
def my_custom_function():
    pass
"""
        save(plugin_path, other_plugin)
        self.assertEqual(other_plugin, load(plugin_path))
        plugin_manager.execute("pre_source")
        self.assertEqual("", output)
예제 #17
0
def test_save_toolchain_args_full():
    folder = temp_folder()
    content = {
        'win_path': r'my\win\path',
        'command': r'conan --option "My Option"',
        'my_regex': r'([A-Z])\w+'
    }
    save_toolchain_args(content, generators_folder=folder)
    args = load(os.path.join(folder, CONAN_TOOLCHAIN_ARGS_FILE))
    assert "[%s]" % CONAN_TOOLCHAIN_ARGS_SECTION in args
    assert r'win_path = my\win\path' in args
예제 #18
0
def get_version():
    try:
        version = os.getenv('PROJECT_VERSION', None)
        if version:
            return version

        content = load('CMakeLists.txt')
        version = re.search('set\(PROJECT_VERSION (.*)\)', content).group(1)
        return version.strip()
    except:
        return None
예제 #19
0
 def no_conan_metadata_files_test(self):
     metadata_files = ["conaninfo.txt", "conanmanifest.txt"]
     # Assert not in directory tree
     for root, _, _ in os.walk(self.client.current_folder):
         for name in metadata_files:
             self.assertNotIn(name, os.listdir(root))
     # Assert not in manifest
     manifest_path = os.path.join(self.client.current_folder, "deploy_manifest.txt")
     content = load(manifest_path)
     for name in metadata_files:
         self.assertNotIn(name, content)
예제 #20
0
    def test_non_empty_dest_merge(self):
        files = ["file.txt", "subdir/file2.txt"]
        self._save(self.source, files, "fromsrc")

        files_dest = ["file.txt", "subdir2/file2.txt"]
        self._save(self.dest, files_dest, "fromdest")

        merge_directories(self.source, self.dest)
        self._assert_equals(self._get_paths(self.dest), files + files_dest)
        # File from src overrides file from dest
        self.assertEqual(load(join(self.dest, "file.txt")), "fromsrc")
예제 #21
0
    def test_delimiter_error(self):
        # https://github.com/conan-io/conan/issues/3080
        conanfile = """from conans import ConanFile
class TestConan(ConanFile):
    settings = "os", "compiler", "arch", "build_type"
"""
        client = TestClient()
        client.save({"conanfile.py": conanfile})
        client.run('install . -g virtualbuildenv -s os=Windows -s compiler="Visual Studio"'
                   ' -s compiler.runtime=MD -s compiler.version=15')
        bat = load(os.path.join(client.current_folder, "activate_build.bat"))
        self.assertIn('SET CL=-MD -DNDEBUG -O2 -Ob2 %CL%', bat)
예제 #22
0
    def test_install_recipe_revision(self):
        """ Specifying the revision, it has to install that revision.
        """
        conanfile = """from conans import ConanFile
class ConanFileToolsTest(ConanFile):
    pass
"""
        ref = ConanFileReference.loads("Hello/0.1@lasote/stable")

        # Upload recipe rev 1 + package to remote0
        self.client.save({"conanfile.py": conanfile})
        self.client.run("create . %s" % str(ref))
        self.client.run("upload %s -r=remote0 --all" % str(ref))
        rev1 = self.client.get_revision(ref)

        # Upload recipe rev 2 + package to remote0
        self.client.save({"conanfile.py": conanfile + "\n#Comment for rev2"})
        self.client.run("create . %s" % str(ref))
        self.client.run("upload %s -r=remote0 --all" % str(ref))
        rev2 = self.client.get_revision(ref)

        self.assertNotEqual(rev1, rev2)

        # Remove all from local
        self.client.run("remove %s -f" % str(ref))

        # Try to install rev1 and not rev2
        self.client.run("install %s#%s" % (str(ref), rev1))
        conanfile_path = self.client.client_cache.conanfile(ref)
        contents = load(conanfile_path)
        self.assertNotIn("#Comment for rev2", contents)

        # Remove all from local
        self.client.run("remove %s -f" % str(ref))

        # Try to install rev2 and not rev1
        self.client.run("install %s#%s" % (str(ref), rev2))
        conanfile_path = self.client.client_cache.conanfile(ref)
        contents = load(conanfile_path)
        self.assertIn("#Comment for rev2", contents)
    def generate_module_file(self, name, deps_cpp_info):
        template = load(os.path.join(os.path.dirname(__file__), "templates", "Build.cs"))
        template = template.replace("{name}", name)
        template = template.replace("{include_paths}", ",\n".join('"%s"' % p.replace("\\", "/") for p in deps_cpp_info.include_paths))
        template = template.replace("{bin_paths}", ",\n".join('"%s"' % p.replace("\\", "/") for p in deps_cpp_info.bin_paths))
        template = template.replace("{lib_paths}", ",\n".join('"%s"' % p.replace("\\", "/") for p in deps_cpp_info.lib_paths))
        template = template.replace("{libs}", ", ".join('"%s.lib"' % p for p in deps_cpp_info.libs))
        template = template.replace("{definitions}", ", ".join('"%s"' % p for p in deps_cpp_info.defines))

        template = template.replace("{cppflags}", " ".join('%s' % p for p in deps_cpp_info.cppflags))
        template = template.replace("{cflags}", " ".join('%s' % p for p in deps_cpp_info.cflags))
        template = template.replace("{sharedlinkflags}", " ".join('%s' % p for p in deps_cpp_info.sharedlinkflags))
        template = template.replace("{exelinkflags}", " ".join('%s' % p for p in deps_cpp_info.exelinkflags))

        return template
예제 #24
0
파일: tools.py 프로젝트: yfxu1990/conan
 def create(self, ref, conanfile=None, args=None, assert_error=False):
     conanfile = str(conanfile) if conanfile else str(GenConanfile())
     self.save({"conanfile.py": conanfile})
     self.run("create . {} {} --json {}".format(ref.full_str(),
                                                args or "", self.tmp_json_name),
              assert_error=assert_error)
     rrev = self.cache.package_layout(ref).recipe_revision()
     json_path = os.path.join(self.current_folder, self.tmp_json_name)
     data = json.loads(load(json_path))
     if assert_error:
         return None
     package_id = data["installed"][0]["packages"][0]["id"]
     package_ref = PackageReference(ref, package_id)
     prev = self.cache.package_layout(ref.copy_clear_rev()).package_revision(package_ref)
     return package_ref.copy_with_revs(rrev, prev)
예제 #25
0
 def get_project_config_content(self):
     project_config_content_file_path = os.path.join(self.get_boost_generator_source_path(), "project-config.template.jam")
     project_config_content = load(project_config_content_file_path)
     return project_config_content \
         .replace("{{{toolset}}}", self.b2_toolset) \
         .replace("{{{toolset_version}}}", self.b2_toolset_version) \
         .replace("{{{toolset_exec}}}", self.b2_toolset_exec) \
         .replace("{{{zlib_lib_paths}}}", self.zlib_lib_paths) \
         .replace("{{{zlib_include_paths}}}", self.zlib_include_paths) \
         .replace("{{{bzip2_lib_paths}}}", self.bzip2_lib_paths) \
         .replace("{{{bzip2_include_paths}}}", self.bzip2_include_paths) \
         .replace("{{{python_exec}}}", self.b2_python_exec) \
         .replace("{{{python_version}}}", self.b2_python_version) \
         .replace("{{{python_include}}}", self.b2_python_include) \
         .replace("{{{python_lib}}}", self.b2_python_lib)
예제 #26
0
def configuration_install(uri,
                          cache,
                          output,
                          verify_ssl,
                          requester,
                          config_type=None,
                          args=None,
                          source_folder=None,
                          target_folder=None):
    configs = []
    configs_file = cache.config_install_file
    if os.path.isfile(configs_file):
        try:
            configs = json.loads(load(configs_file))
        except Exception as e:
            raise ConanException("Error loading configs-install file: %s\n%" %
                                 (configs_file, str(e)))
        configs = [_ConfigOrigin(config) for config in configs]
    if uri is None:
        if config_type or args or not verify_ssl:  # Not the defaults
            if not configs:
                raise ConanException("Called config install without arguments")
            # Modify the last one
            config = configs[-1]
            config.config_type = config_type or config.type
            config.args = args or config.args
            config.verify_ssl = verify_ssl or config.verify_ssl
            _process_config(config, cache, output, requester)
            _save_configs(configs_file, configs)
        else:
            if not configs:
                raise ConanException("Called config install without arguments")
            # Execute the previously stored ones
            for config in configs:
                output.info("Config install:  %s" % _hide_password(config.uri))
                _process_config(config, cache, output, requester)
    else:
        # Execute and store the new one
        config = _ConfigOrigin.from_item(uri, config_type, verify_ssl, args,
                                         source_folder, target_folder)
        _process_config(config, cache, output, requester)
        if config not in configs:
            configs.append(config)
        else:
            configs = [(c if c != config else config) for c in configs]
        _save_configs(configs_file, configs)
예제 #27
0
def test_cache_in_layout(conanfile):
    """The layout in the cache is used too, always relative to the "base" folders that the cache
    requires. But by the default, the "package" is not followed
    """
    client = TestClient()
    client.save({"conanfile.py": GenConanfile()})
    client.run("create . base/1.0@")

    client.save({"conanfile.py": conanfile})
    client.run("create . lib/1.0@")
    package_id = re.search(r"lib/1.0:(\S+)", str(client.out)).group(1)
    ref = ConanFileReference.loads("lib/1.0@")
    pref = PackageReference(ref, package_id)
    sf = client.cache.package_layout(ref).source()
    bf = client.cache.package_layout(ref).build(pref)
    pf = client.cache.package_layout(ref).package(pref)

    source_folder = os.path.join(sf, "my_sources")
    build_folder = os.path.join(bf, "my_build")

    # Check folders match with the declared by the layout
    assert "Source folder: {}".format(source_folder) in client.out
    assert "Build folder: {}".format(build_folder) in client.out
    # Check the source folder
    assert os.path.exists(os.path.join(source_folder, "source.h"))

    # Check the build folder
    assert os.path.exists(os.path.join(build_folder, "build.lib"))

    # Check the conaninfo
    assert os.path.exists(os.path.join(pf, "conaninfo.txt"))

    # Search the package in the cache
    client.run("search lib/1.0@")
    assert "Package_ID: {}".format(package_id) in client.out

    # Install the package and check the build info
    client.run("install lib/1.0@ -g txt")
    binfopath = os.path.join(client.current_folder, "conanbuildinfo.txt")
    content = load(binfopath).replace("\r\n", "\n")
    assert "[includedirs]\n{}".format(
        os.path.join(pf, "include").replace("\\", "/")) in content
    assert "[libdirs]\n{}".format(os.path.join(pf,
                                               "lib").replace("\\",
                                                              "/")) in content
예제 #28
0
def _get_local_infos_min(server_store, ref, look_in_all_rrevs):

    result = {}
    rrevs = server_store.get_recipe_revisions(ref) if look_in_all_rrevs else [
        None
    ]

    for rrev in rrevs:
        new_ref = ref.copy_with_rev(rrev.revision) if rrev else ref
        subdirs = list_folder_subdirs(server_store.packages(new_ref), level=1)
        for package_id in subdirs:
            if package_id in result:
                continue
            # Read conaninfo
            try:
                pref = PackageReference(new_ref, package_id)
                revision_entry = server_store.get_last_package_revision(pref)
                if not revision_entry:
                    raise NotFoundException("")
                pref = PackageReference(new_ref, package_id,
                                        revision_entry.revision)
                info_path = os.path.join(server_store.package(pref), CONANINFO)
                if not os.path.exists(info_path):
                    raise NotFoundException("")
                content = load(info_path)
                info = ConanInfo.loads(content)
                # From Conan 1.48 the conaninfo.txt is sent raw.
                result[package_id] = {"content": content}
                # FIXME: This could be removed in the conan_server, Artifactory should keep it
                #        to guarantee compatibility with old conan clients.
                conan_vars_info = info.serialize_min()
                result[package_id].update(conan_vars_info)

            except Exception as exc:  # FIXME: Too wide
                logger.error("Package %s has no ConanInfo file" % str(pref))
                if str(exc):
                    logger.error(str(exc))
    return result
예제 #29
0
파일: tools.py 프로젝트: echoIamnoob/conan
 def load(self, filename):
     return load(os.path.join(self.current_folder, filename))
예제 #30
0
def _handle_remotes(cache, remote_file):
    # FIXME: Should we encourage to pass the remotes in json?
    remotes, _ = load_registry_txt(load(remote_file))
    cache.registry.define(remotes)