def stop_build_info(output): paths = ClientCache(os.path.join(get_conan_user_home(), ".conan"), output) artifact_properties_file = paths.artifacts_properties_path try: save(artifact_properties_file, "") except Exception: raise ConanException("Can't write properties file in %s" % artifact_properties_file)
def __init__(self, output, build_info_file, lockfile, user=None, password=None, apikey=None): self._build_info_file = build_info_file self._lockfile = lockfile self._user = user self._password = password self._apikey = apikey self._output = output self._conan_cache = ClientCache(os.path.join(get_conan_user_home(), ".conan"), output)
def start_build_info(output, build_name, build_number): paths = ClientCache(os.path.join(get_conan_user_home(), ".conan"), output) content = ARTIFACTS_PROPERTIES_PUT_PREFIX + "build.name={}\n".format(build_name) + \ ARTIFACTS_PROPERTIES_PUT_PREFIX + "build.number={}\n".format(build_number) artifact_properties_file = paths.artifacts_properties_path try: save(artifact_properties_file, content) except Exception: raise ConanException("Can't write properties file in %s" % artifact_properties_file)
def start_build_info(output, build_name, build_number): paths = ClientCache(os.path.join(get_conan_user_home(), ".conan"), output) content = "artifact_property_build.name={}\n" \ "artifact_property_build.number={}\n".format(build_name, build_number) artifact_properties_file = paths.put_headers_path try: save(artifact_properties_file, content) except Exception: raise ConanException("Can't write properties file in %s" % artifact_properties_file)
def factory(): """Factory""" def instance_remote_manager(client_cache): requester = get_basic_requester(client_cache) # Verify client version against remotes version_checker_req = VersionCheckerRequester( requester, Version(client_version), Version(MIN_SERVER_COMPATIBLE_VERSION), out) # To handle remote connections put_headers = client_cache.read_put_headers() rest_api_client = RestApiClient(out, requester=version_checker_req, put_headers=put_headers) # To store user and token localdb = LocalDB(client_cache.localdb) # Wraps RestApiClient to add authentication support (same interface) auth_manager = ConanApiAuthManager(rest_api_client, user_io, localdb) # Handle remote connections remote_manager = RemoteManager(client_cache, auth_manager, out) return remote_manager use_color = get_env("CONAN_COLOR_DISPLAY", 1) if use_color and hasattr(sys.stdout, "isatty") and sys.stdout.isatty(): import colorama colorama.init() color = True else: color = False out = ConanOutput(sys.stdout, color) user_io = UserIO(out=out) try: client_cache = migrate_and_get_client_cache( get_conan_user_home(), out) except Exception as e: out.error(str(e)) raise with tools.environment_append(client_cache.conan_config.env_vars): # Adjust CONAN_LOGGING_LEVEL with the env readed conans.util.log.logger = configure_logger() # Get the new command instance after migrations have been done remote_manager = instance_remote_manager(client_cache) # Get a search manager search_adapter = DiskSearchAdapter() search_manager = DiskSearchManager(client_cache, search_adapter) # Settings preprocessor conan = Conan(client_cache, user_io, get_conan_runner(), remote_manager, search_manager, settings_preprocessor) return conan, client_cache, user_io
def __init__(self, cache_folder=None, quiet=True, user_io=None, http_requester=None, runner=None): self.out = ConanOutput(quiet=quiet) self.user_io = user_io or UserIO(out=self.out) self.cache_folder = cache_folder or os.path.join(get_conan_user_home(), ".conan") self.http_requester = http_requester self.runner = runner # Migration system migrator = ClientMigrator(self.cache_folder, Version(client_version), self.out) migrator.migrate()
def __init__(self, output, build_info_file, lockfile, multi_module=True, skip_env=True, user=None, password=None, apikey=None): self._build_info_file = build_info_file self._lockfile = lockfile self._multi_module = multi_module self._skip_env = skip_env self._user = user self._password = password self._apikey = apikey self._conan_cache = ClientCache(os.path.join(get_conan_user_home(), ".conan"), output)
def factory(interactive=None): """Factory""" # Respect color env setting or check tty if unset color_set = "CONAN_COLOR_DISPLAY" in os.environ if ((color_set and get_env("CONAN_COLOR_DISPLAY", 1)) or (not color_set and hasattr(sys.stdout, "isatty") and sys.stdout.isatty())): import colorama if get_env("PYCHARM_HOSTED"): # in PyCharm disable convert/strip colorama.init(convert=False, strip=False) else: colorama.init() color = True else: color = False out = ConanOutput(sys.stdout, color) user_io = UserIO(out=out) try: user_home = get_conan_user_home() client_cache = migrate_and_get_client_cache(user_home, out) sys.path.append(os.path.join(user_home, "python")) except Exception as e: out.error(str(e)) raise with tools.environment_append(client_cache.conan_config.env_vars): # Adjust CONAN_LOGGING_LEVEL with the env readed conans.util.log.logger = configure_logger() # Create Plugin Manager plugin_manager = PluginManager(client_cache.plugins_path, get_env("CONAN_PLUGINS", list()), user_io.out) # Get the new command instance after migrations have been done requester = get_basic_requester(client_cache) _, _, remote_manager = ConanAPIV1.instance_remote_manager( requester, client_cache, user_io, Version(client_version), Version(MIN_SERVER_COMPATIBLE_VERSION), plugin_manager) # Adjust global tool variables set_global_instances(out, requester) # Settings preprocessor if interactive is None: interactive = not get_env("CONAN_NON_INTERACTIVE", False) conan = ConanAPIV1(client_cache, user_io, get_conan_runner(), remote_manager, plugin_manager, interactive=interactive) return conan, client_cache, user_io
def factory(interactive=None): """Factory""" use_color = get_env("CONAN_COLOR_DISPLAY", 1) if use_color and hasattr(sys.stdout, "isatty") and sys.stdout.isatty(): import colorama colorama.init() color = True else: color = False out = ConanOutput(sys.stdout, color) user_io = UserIO(out=out) try: user_home = get_conan_user_home() client_cache = migrate_and_get_client_cache(user_home, out) sys.path.append(os.path.join(user_home, "python")) except Exception as e: out.error(str(e)) raise with tools.environment_append(client_cache.conan_config.env_vars): # Adjust CONAN_LOGGING_LEVEL with the env readed conans.util.log.logger = configure_logger() # Get the new command instance after migrations have been done requester = get_basic_requester(client_cache) _, _, remote_manager = ConanAPIV1.instance_remote_manager( requester, client_cache, user_io, Version(client_version), Version(MIN_SERVER_COMPATIBLE_VERSION)) # Adjust global tool variables set_global_instances(out, requester) # Get a search manager search_manager = DiskSearchManager(client_cache) # Settings preprocessor if interactive is None: interactive = not get_env("CONAN_NON_INTERACTIVE", False) conan = Conan(client_cache, user_io, get_conan_runner(), remote_manager, search_manager, settings_preprocessor, interactive=interactive) return conan, client_cache, user_io
def main(): parser = argparse.ArgumentParser( formatter_class=argparse.ArgumentDefaultsHelpFormatter, description='Modify Conan settings.yml configuration') parser.add_argument('--merge-file', nargs='*', default=[], help='YAML config file to merge') parser.add_argument('--method', default='METHOD_MERGE') bool_arg(parser, 'mergelists', True) bool_arg(parser, 'interpolate', False) bool_arg(parser, 'castinterpolated', False) bool_arg(parser, 'usedefaultyamlloader', False) bool_arg(parser, 'failonmissingfiles', True) args = parser.parse_args() in_data = get_stdin() or '' in_data += "\n" # newline is used to distinguish yaml from filename output = ConanOutput(sys.stdout, sys.stderr, True) conan_cache = cache.ClientCache( os.path.join(get_conan_user_home(), '.conan'), output) path = conan_cache.settings_path existing = cache.load(path) \ if os.path.exists(path) \ else default_settings() method = hiyapyco.METHODS[args.method] settings = hiyapyco.load([existing, in_data], *args.merge_file, mergelists=args.mergelists, method=method, interpolate=args.interpolate, castinterpolated=args.castinterpolated, usedefaultyamlloader=args.usedefaultyamlloader, failonmissingfiles=args.failonmissingfiles) settings_yml = hiyapyco.dump(settings) cache.save(path, normalize(settings_yml), only_if_modified=True)
def __init__(self, conanfile): super().__init__(conanfile) self.cache_root = Path(get_conan_user_home()) / '.conan' / 'data'