def __init__(self, profile_text, username, channel, reference, mingw_ref=None, runner=None, args=None, conan_pip_package=None, docker_image=None, docker_image_skip_update=False): super(DockerTestPackageRunner, self).__init__(profile_text, username, channel, reference, mingw_installer_reference=mingw_ref, runner=runner, args=args, conan_pip_package=conan_pip_package) self.docker_image = docker_image or autodetect_docker_image( self.profile) self.docker_image_skip_update = docker_image_skip_update self.sudo_command = "" if "CONAN_DOCKER_USE_SUDO" in os.environ: if get_bool_from_env("CONAN_DOCKER_USE_SUDO"): self.sudo_command = "sudo" elif platform.system() == "Linux": self.sudo_command = "sudo"
def __init__(self, args=None, username=None, channel=None, runner=None, gcc_versions=None, visual_versions=None, visual_runtimes=None, apple_clang_versions=None, archs=None, use_docker=None, curpage=None, total_pages=None, docker_image=None, reference=None, password=None, remote=None, remotes=None, upload=None, stable_branch_pattern=None, vs10_x86_64_enabled=False, mingw_configurations=None, stable_channel=None, platform_info=None, upload_retry=None, clang_versions=None, login_username=None, upload_only_when_stable=False, build_types=None, skip_check_credentials=False, allow_gcc_minors=False, exclude_vcvars_precommand=False, docker_image_skip_update=False, docker_entry_script=None, docker_32_images=None): self.sudo_command = "" if "CONAN_DOCKER_USE_SUDO" in os.environ: if get_bool_from_env("CONAN_DOCKER_USE_SUDO"): self.sudo_command = "sudo" elif platform.system() == "Linux": self.sudo_command = "sudo" self.exclude_vcvars_precommand = exclude_vcvars_precommand or os.getenv("CONAN_EXCLUDE_VCVARS_PRECOMMAND", False) self.docker_image_skip_update = docker_image_skip_update or os.getenv("CONAN_DOCKER_IMAGE_SKIP_UPDATE", False) self.allow_gcc_minors = allow_gcc_minors or os.getenv("CONAN_ALLOW_GCC_MINORS", False) self._builds = [] self._named_builds = {} self._platform_info = platform_info or PlatformInfo() self.runner = runner or os.system self.output_runner = ConanOutputRunner() self.args = args or " ".join(sys.argv[1:]) self.username = username or os.getenv("CONAN_USERNAME", None) self.login_username = login_username or os.getenv("CONAN_LOGIN_USERNAME", None) or self.username if not self.username: raise Exception("Instance ConanMultiPackage with 'username' " "parameter or use CONAN_USERNAME env variable") # Upload related variables self.upload_retry = upload_retry or os.getenv("CONAN_UPLOAD_RETRY", 3) self.reference = reference or os.getenv("CONAN_REFERENCE", None) self.password = password or os.getenv("CONAN_PASSWORD", None) self.remote = remote or os.getenv("CONAN_REMOTE", None) # User is already logged self._logged_user_in_remote = defaultdict(lambda: False) if self.remote: raise Exception(''' 'remote' argument is deprecated. Use: - 'upload' argument to specify the remote URL to upload your packages (or None to disable upload) - 'remotes' argument to specify additional remote URLs, for example, different user repositories. ''') self.remotes = remotes or os.getenv("CONAN_REMOTES", []) self.upload = upload if upload is not None else os.getenv("CONAN_UPLOAD", None) # The username portion of the remote URLs must be all lowercase to work if self.remotes: if isinstance(self.remotes,list): self.remotes = [remote.lower() for remote in self.remotes] else: self.remotes = self.remotes.lower() if self.upload: self.upload = self.upload.lower() self.stable_branch_pattern = stable_branch_pattern or \ os.getenv("CONAN_STABLE_BRANCH_PATTERN", None) default_channel = channel or os.getenv("CONAN_CHANNEL", "testing") self.stable_channel = stable_channel or os.getenv("CONAN_STABLE_CHANNEL", "stable") self.channel = self._get_channel(default_channel, self.stable_channel) if self.reference: self.reference = ConanFileReference.loads("%s@%s/%s" % (self.reference, self.username, self.channel)) self.upload_only_when_stable = upload_only_when_stable or \ os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", False) self.skip_check_credentials = skip_check_credentials or \ os.getenv("CONAN_SKIP_CHECK_CREDENTIALS", False) self.docker_entry_script = docker_entry_script or \ os.getenv("CONAN_DOCKER_ENTRY_SCRIPT", None) if self.upload: if self.upload in ("0", "None", "False"): self.upload = None elif self.upload == "1": raise Exception("WARNING! 'upload' argument has changed. Use 'upload' argument or " "CONAN_UPLOAD environment variable to specify a remote URL to " "upload your packages. e.j: " "upload='https://api.bintray.com/conan/myuser/myconanrepo'") os.environ["CONAN_CHANNEL"] = self.channel self.clang_versions = clang_versions or split_colon_env("CONAN_CLANG_VERSIONS") self.gcc_versions = gcc_versions or split_colon_env("CONAN_GCC_VERSIONS") # If there are some GCC versions declared then we don't default the clang # versions if not self.clang_versions and not self.gcc_versions: self.clang_versions = self.default_clang_versions # If there are some CLANG versions declared then we don't default the gcc # versions if not self.gcc_versions and self.clang_versions == self.default_clang_versions: self.gcc_versions = self.default_gcc_versions if self.gcc_versions and not self.allow_gcc_minors: for a_version in self.gcc_versions: if Version(a_version) >= Version("5") and "." in a_version: raise Exception(""" ******************* DEPRECATED GCC MINOR VERSIONS! *************************************** - The use of gcc versions >= 5 and specifying the minor version (e.j "5.4") is deprecated. - The ABI of gcc >= 5 (5, 6, and 7) is compatible between minor versions (e.j 5.3 is compatible with 5.4) - Specify only the major in your script: - CONAN_GCC_VERSIONS="5,6,7" if you are using environment variables. - gcc_versions=["5", "6", "7"] if you are using the constructor parameter. You can still keep using the same docker images, or use the new "lasote/conangcc5", "lasote/conangcc6", "lasote/conangcc7" If you still want to keep the old behavior, set the environment var CONAN_ALLOW_GCC_MINORS or pass the "allow_gcc_minors=True" parameter. But it is not recommended, if your packages are public most users won't be able to use them. ****************************************************************************************** """) if visual_versions is not None: self.visual_versions = visual_versions else: self.visual_versions = split_colon_env("CONAN_VISUAL_VERSIONS") if not self.visual_versions and not mingw_configurations and not get_mingw_config_from_env(): self.visual_versions = self.default_visual_versions elif mingw_configurations or get_mingw_config_from_env(): self.visual_versions = [] self.visual_runtimes = visual_runtimes or split_colon_env("CONAN_VISUAL_RUNTIMES") or \ self.default_visual_runtimes self.apple_clang_versions = apple_clang_versions or \ split_colon_env("CONAN_APPLE_CLANG_VERSIONS") or \ self.default_apple_clang_versions self.mingw_configurations = mingw_configurations or get_mingw_config_from_env() env_ref = os.getenv("CONAN_MINGW_INSTALLER_REFERENCE") self.mingw_installer_reference = ConanFileReference.loads(env_ref or "mingw_installer/1.0" "@conan/stable") if not archs and not os.getenv("CONAN_ARCHS") and platform.system() == "Darwin": self.default_archs = ["x86_64"] # No longer supported (by default) x86 macos self.archs = archs or split_colon_env("CONAN_ARCHS") or self.default_archs self.build_types = build_types or split_colon_env("CONAN_BUILD_TYPES") or \ self.default_build_types # If CONAN_DOCKER_IMAGE is speified, then use docker is True self.use_docker = use_docker or os.getenv("CONAN_USE_DOCKER", False) or \ (os.getenv("CONAN_DOCKER_IMAGE", None) is not None) if docker_32_images is not None: self.docker_32_images = docker_32_images else: self.docker_32_images = os.getenv("CONAN_DOCKER_32_IMAGES", False) self.curpage = curpage or os.getenv("CONAN_CURRENT_PAGE", 1) self.total_pages = total_pages or os.getenv("CONAN_TOTAL_PAGES", 1) self.docker_image = docker_image or os.getenv("CONAN_DOCKER_IMAGE", None) if self.password: self.password = self.password.replace('"', '\\"') self.conan_pip_package = os.getenv("CONAN_PIP_PACKAGE", "conan==%s" % client_version) self.vs10_x86_64_enabled = vs10_x86_64_enabled # Set the remotes if self.remotes: if not isinstance(self.remotes, list): self.remotes = [r.strip() for r in self.remotes.split(",") if r.strip()] for counter, remote in enumerate(reversed(self.remotes)): remote_name = "remote%s" % counter if remote != self.upload else "upload_repo" self.add_remote_safe(remote_name, remote, insert=True) self.runner("conan remote list") else: logger.info("Not additional remotes declared...") if self.upload and self.upload not in self.remotes: # If you specify the upload as a remote, put it first # this way we can cover all the possibilities self.add_remote_safe("upload_repo", self.upload, insert=False) _, client_cache, _ = Conan.factory() self.data_home = client_cache.store self.builds_in_current_page = []