Example #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)
Example #2
0
    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)
Example #3
0
    def export(self, user, conan_file_path, keep_source=False):
        """ 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)
        user_name, channel = get_user_channel(user)
        conan_file = self._loader().load_conan(os.path.join(conan_file_path, CONANFILE),
                                               self._user_io.out)
        url = getattr(conan_file, "url", None)
        license_ = getattr(conan_file, "license", None)
        if not url:
            self._user_io.out.warn("Conanfile doesn't have 'url'.\n"
                                   "It is recommended to add your repo URL as attribute")
        if not license_:
            self._user_io.out.warn("Conanfile doesn't have a 'license'.\n"
                                   "It is recommended to add the package license as attribute")

        conan_ref = ConanFileReference(conan_file.name, conan_file.version, user_name, channel)

        conan_ref_str = str(conan_ref)
        # Maybe a platform check could be added, but depends on disk partition
        info = self.file_manager.search(conan_ref_str, ignorecase=True)
        refs = {s for s in info.keys() if str(s).lower() == conan_ref_str.lower()}
        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._paths,
                         conan_file.exports, conan_file_path, conan_ref, keep_source)
Example #4
0
    def export(self, user, conan_file_path, keep_source=False):
        """ 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)
        user_name, channel = get_user_channel(user)
        conan_file = self._loader().load_class(os.path.join(conan_file_path, CONANFILE))
        for field in ["url", "license", "description"]:
            field_value = getattr(conan_file, field, None)
            if not field_value:
                self._user_io.out.warn("Conanfile doesn't have '%s'.\n"
                                       "It is recommended to add it as attribute" % field)
        if getattr(conan_file, "conan_info", None):
            self._user_io.out.warn("conan_info() method is deprecated, use package_id() instead")

        conan_ref = ConanFileReference(conan_file.name, conan_file.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, conan_file, conan_file_path,
                         conan_ref, conan_file.short_paths, keep_source)
Example #5
0
    def export(self, user, conan_file_path, keep_source=False):
        """ 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)
        user_name, channel = get_user_channel(user)
        conan_file = self._loader().load_conan(os.path.join(conan_file_path, CONANFILE),
                                               self._user_io.out)
        url = getattr(conan_file, "url", None)
        license_ = getattr(conan_file, "license", None)
        if not url:
            self._user_io.out.warn("Conanfile doesn't have 'url'.\n"
                                   "It is recommended to add your repo URL as attribute")
        if not license_:
            self._user_io.out.warn("Conanfile doesn't have a 'license'.\n"
                                   "It is recommended to add the package license as attribute")

        conan_ref = ConanFileReference(conan_file.name, conan_file.version, user_name, channel)
        conan_ref_str = str(conan_ref)
        # Maybe a platform check could be added, but depends on disk partition
        info = self.file_manager.search(conan_ref_str, ignorecase=True)
        refs = {s for s in info.keys() if str(s).lower() == conan_ref_str.lower()}
        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._paths, conan_file.exports, conan_file_path, conan_ref,
                         conan_file.short_paths, keep_source)
Example #6
0
    def export(self, user, conan_file_path, keep_source=False):
        """ 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)
        user_name, channel = get_user_channel(user)
        conan_file = self._loader().load_class(os.path.join(conan_file_path, CONANFILE))
        for field in ["url", "license", "description"]:
            field_value = getattr(conan_file, field, None)
            if not field_value:
                self._user_io.out.warn("Conanfile doesn't have '%s'.\n"
                                       "It is recommended to add it as attribute" % field)

        conan_ref = ConanFileReference(conan_file.name, conan_file.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, conan_file.exports, conan_file_path,
                         conan_ref, conan_file.short_paths, keep_source)
Example #7
0
    def export(self, user, conan_file_path, keep_source=False):
        """ 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)
        user_name, channel = get_user_channel(user)
        conan_file = self._loader().load_conan(os.path.join(conan_file_path, CONANFILE),
                                               self._user_io.out)
        url = getattr(conan_file, "url", None)
        license_ = getattr(conan_file, "license", None)
        if not url:
            self._user_io.out.warn("Conanfile doesn't have 'url'.\n"
                                   "It is recommended to add your repo URL as attribute")
        if not license_:
            self._user_io.out.warn("Conanfile doesn't have a 'license'.\n"
                                   "It is recommended to add the package license as attribute")

        conan_ref = ConanFileReference(conan_file.name, conan_file.version, user_name, channel)
        output = ScopedOutput(str(conan_ref), self._user_io.out)
        export_conanfile(output, self._paths,
                         conan_file.exports, conan_file_path, conan_ref, keep_source)
Example #8
0
 def export(self, user, conan_file_path):
     """ 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)
     user_name, channel = get_user_channel(user)
     conan_file = self._loader().load_conan(os.path.join(conan_file_path, CONANFILE))
     conan_ref = ConanFileReference(conan_file.name, conan_file.version, user_name, channel)
     export_conanfile(self._user_io.out, self._paths,
                      conan_file.exports, conan_file_path, conan_ref)