예제 #1
0
    def export(self, user, channel, conan_file_path, keep_source=False, filename=None, name=None,
               version=None):
        """ Export the conans
        param conanfile_path: the original source directory of the user containing a
                           conanfile.py
        param user: user under this package will be exported
        param channel: string (stable, testing,...)
        """
        assert conan_file_path
        logger.debug("Exporting %s" % conan_file_path)

        src_folder = conan_file_path
        conanfile_name = filename or CONANFILE
        conan_file_path = os.path.join(conan_file_path, conanfile_name)
        if ((os.path.exists(conan_file_path) and conanfile_name not in os.listdir(src_folder)) or
                (conanfile_name != "conanfile.py" and conanfile_name.lower() == "conanfile.py")):
            raise ConanException("Wrong '%s' case" % conanfile_name)
        conan_linter(conan_file_path, self._user_io.out)
        conanfile = load_export_conanfile(conan_file_path, self._user_io.out, name, version)
        conan_ref = ConanFileReference(conanfile.name, conanfile.version, user, channel)
        conan_ref_str = str(conan_ref)
        # Maybe a platform check could be added, but depends on disk partition
        refs = self._search_manager.search(conan_ref_str, ignorecase=True)
        if refs and conan_ref not in refs:
            raise ConanException("Cannot export package with same name but different case\n"
                                 "You exported '%s' but already existing '%s'"
                                 % (conan_ref_str, " ".join(str(s) for s in refs)))
        output = ScopedOutput(str(conan_ref), self._user_io.out)
        export_conanfile(output, self._client_cache, conanfile, src_folder, conan_ref, keep_source,
                         filename)
예제 #2
0
파일: manager.py 프로젝트: nesono/conan
    def export(self, user, conan_file_path, keep_source=False, filename=None):
        """ Export the conans
        param conanfile_path: the original source directory of the user containing a
                           conanfile.py
        param user: user under this package will be exported
        param channel: string (stable, testing,...)
        """
        assert conan_file_path
        logger.debug("Exporting %s" % conan_file_path)
        try:
            user_name, channel = user.split("/")
        except:
            user_name, channel = user, "testing"

        src_folder = conan_file_path
        conanfile_name = filename or CONANFILE
        conan_file_path = os.path.join(conan_file_path, conanfile_name)
        if ((os.path.exists(conan_file_path) and conanfile_name not in os.listdir(src_folder)) or
                (conanfile_name != "conanfile.py" and conanfile_name.lower() == "conanfile.py")):
            raise ConanException("Wrong '%s' case" % conanfile_name)
        conan_linter(conan_file_path, self._user_io.out)
        conanfile = load_export_conanfile(conan_file_path, self._user_io.out)
        conan_ref = ConanFileReference(conanfile.name, conanfile.version, user_name, channel)
        conan_ref_str = str(conan_ref)
        # Maybe a platform check could be added, but depends on disk partition
        refs = self._search_manager.search(conan_ref_str, ignorecase=True)
        if refs and conan_ref not in refs:
            raise ConanException("Cannot export package with same name but different case\n"
                                 "You exported '%s' but already existing '%s'"
                                 % (conan_ref_str, " ".join(str(s) for s in refs)))
        output = ScopedOutput(str(conan_ref), self._user_io.out)
        export_conanfile(output, self._client_cache, conanfile, src_folder, conan_ref, keep_source,
                         filename)