Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install pip deps like conda #2241

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion libmamba/include/mamba/core/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ namespace mamba
class TemporaryFile
{
public:
TemporaryFile(const std::string& prefix = "mambaf", const std::string& suffix = "");
TemporaryFile(const std::string& prefix = "mambaf",
const std::string& suffix = "",
const std::optional<fs::u8path>& dir = std::nullopt);
~TemporaryFile();

TemporaryFile(const TemporaryFile&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion libmamba/src/api/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace mamba

const auto& ctx = Context::instance();

TemporaryFile specs;
TemporaryFile specs("mambaf", "", cwd);
{
std::ofstream specs_f = open_ofstream(specs.path());
for (auto& d : deps)
Expand Down
7 changes: 5 additions & 2 deletions libmamba/src/core/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,15 @@ namespace mamba
return m_path;
}

TemporaryFile::TemporaryFile(const std::string& prefix, const std::string& suffix)
TemporaryFile::TemporaryFile(const std::string& prefix,
const std::string& suffix,
const std::optional<fs::u8path>& dir)
{
static std::mutex file_creation_mutex;

bool success = false;
fs::u8path temp_path = fs::temp_directory_path(), final_path;
fs::u8path final_path;
fs::u8path temp_path = dir.value_or(fs::temp_directory_path());

std::lock_guard<std::mutex> file_creation_lock(file_creation_mutex);

Expand Down