|
| 1 | +// Copyright (c) 2019, QuantStack and Mamba Contributors |
| 2 | +// |
| 3 | +// Distributed under the terms of the BSD 3-Clause License. |
| 4 | +// |
| 5 | +// The full license is in the file LICENSE, distributed with this software. |
| 6 | + |
| 7 | +#ifndef MAMBA_API_ENVIRONMENT_YAML_HPP |
| 8 | +#define MAMBA_API_ENVIRONMENT_YAML_HPP |
| 9 | + |
| 10 | +#include <iosfwd> |
| 11 | +#include <map> |
| 12 | +#include <string> |
| 13 | +#include <vector> |
| 14 | + |
| 15 | +#include "mamba/fs/filesystem.hpp" |
| 16 | + |
| 17 | +// Include install.hpp for other_pkg_mgr_spec definition (needed by yaml_file_contents) |
| 18 | +#include "mamba/api/install.hpp" |
| 19 | + |
| 20 | +namespace mamba |
| 21 | +{ |
| 22 | + class Context; |
| 23 | + class PrefixData; |
| 24 | + |
| 25 | + namespace detail |
| 26 | + { |
| 27 | + // yaml_file_contents is now defined here instead of install.hpp |
| 28 | + struct yaml_file_contents |
| 29 | + { |
| 30 | + std::string name; |
| 31 | + std::string prefix; |
| 32 | + std::vector<std::string> dependencies, channels; |
| 33 | + std::map<std::string, std::string> variables; |
| 34 | + std::vector<other_pkg_mgr_spec> others_pkg_mgrs_specs; |
| 35 | + }; |
| 36 | + } |
| 37 | + |
| 38 | + // Convert PrefixData to yaml_file_contents |
| 39 | + detail::yaml_file_contents prefix_to_yaml_contents( |
| 40 | + const PrefixData& prefix_data, |
| 41 | + const Context& ctx, |
| 42 | + const std::string& env_name = "", |
| 43 | + bool no_builds = false, |
| 44 | + bool ignore_channels = false |
| 45 | + ); |
| 46 | + |
| 47 | + // Write yaml_file_contents to output stream |
| 48 | + void yaml_contents_to_stream(const detail::yaml_file_contents& contents, std::ostream& out); |
| 49 | + |
| 50 | + // Write yaml_file_contents to YAML file |
| 51 | + void |
| 52 | + yaml_contents_to_file(const detail::yaml_file_contents& contents, const fs::u8path& yaml_file_path); |
| 53 | + |
| 54 | + // Read YAML file to yaml_file_contents |
| 55 | + detail::yaml_file_contents file_to_yaml_contents( |
| 56 | + const Context& ctx, |
| 57 | + const std::string& yaml_file, |
| 58 | + const std::string& platform, |
| 59 | + bool use_uv = false |
| 60 | + ); |
| 61 | +} |
| 62 | + |
| 63 | +#endif |
0 commit comments