Skip to content

Commit 5df985d

Browse files
authored
Merge branch 'main' into dev_loong64
2 parents 0c76c8f + 339715a commit 5df985d

File tree

23 files changed

+303
-60
lines changed

23 files changed

+303
-60
lines changed

dev/environment-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ dependencies:
2929
# micromamba test dependencies
3030
- python
3131
- mitmproxy
32+
- bcrypt==4.0.1 # An indirect dependency pin due to failures on MacOS
3233
- pytest >=7.3.0
3334
- pytest-asyncio
3435
- pytest-timeout

libmamba/ext/solv-cpp/include/solv-cpp/solvable.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ namespace solv
5353
auto build_string() const -> std::string_view;
5454
auto file_name() const -> std::string_view;
5555
auto license() const -> std::string_view;
56+
auto python_site_packages_path() const -> std::string_view;
5657
auto md5() const -> std::string_view;
5758
auto noarch() const -> std::string_view;
5859
auto sha256() const -> std::string_view;
@@ -168,6 +169,17 @@ namespace solv
168169
void set_license(raw_str_view str) const;
169170
void set_license(const std::string& str) const;
170171

172+
/**
173+
* Set the python_site_packages_path of the solvable.
174+
*
175+
* This is not used by libsolv and is purely for data storing.
176+
*
177+
* @note A call to @ref ObjRepoView::internalize is required for this attribute to
178+
* be available for lookup.
179+
*/
180+
void set_python_site_packages_path(raw_str_view str) const;
181+
void set_python_site_packages_path(const std::string& str) const;
182+
171183
/**
172184
* Set the md5 hash of the solvable file.
173185
*

libmamba/ext/solv-cpp/src/solvable.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,22 @@ namespace solv
206206
return set_license(str.c_str());
207207
}
208208

209+
auto ObjSolvableViewConst::python_site_packages_path() const -> std::string_view
210+
{
211+
return ptr_to_strview(::solvable_lookup_str(const_cast<::Solvable*>(raw()), SOLVABLE_MEDIABASE)
212+
);
213+
}
214+
215+
void ObjSolvableView::set_python_site_packages_path(raw_str_view str) const
216+
{
217+
::solvable_set_str(raw(), SOLVABLE_MEDIABASE, str);
218+
}
219+
220+
void ObjSolvableView::set_python_site_packages_path(const std::string& str) const
221+
{
222+
return set_python_site_packages_path(str.c_str());
223+
}
224+
209225
auto ObjSolvableViewConst::md5() const -> std::string_view
210226
{
211227
::Id type = 0;

libmamba/ext/solv-cpp/tests/src/test_solvable.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace
4343
solv.set_build_string("build");
4444
solv.set_file_name("file.tar.gz");
4545
solv.set_license("MIT");
46+
solv.set_python_site_packages_path("dummy_pspp");
4647
solv.set_md5("6f29ba77e8b03b191c9d667f331bf2a0");
4748
solv.set_sha256("ecde63af23e0d49c0ece19ec539d873ea408a6f966d3126994c6d33ae1b9d3f7");
4849
solv.set_signatures(
@@ -62,6 +63,7 @@ namespace
6263
REQUIRE(solv.build_string() == "");
6364
REQUIRE(solv.file_name() == "");
6465
REQUIRE(solv.license() == "");
66+
REQUIRE(solv.python_site_packages_path() == "");
6567
REQUIRE(solv.md5() == "");
6668
REQUIRE(solv.sha256() == "");
6769
REQUIRE(solv.signatures() == "");
@@ -83,6 +85,7 @@ namespace
8385
REQUIRE(solv.build_string() == "build");
8486
REQUIRE(solv.file_name() == "file.tar.gz");
8587
REQUIRE(solv.license() == "MIT");
88+
REQUIRE(solv.python_site_packages_path() == "dummy_pspp");
8689
REQUIRE(solv.md5() == "6f29ba77e8b03b191c9d667f331bf2a0");
8790
REQUIRE(
8891
solv.sha256() == "ecde63af23e0d49c0ece19ec539d873ea408a6f966d3126994c6d33ae1b9d3f7"

libmamba/include/mamba/core/transaction.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,16 @@ namespace mamba
8282
History::UserRequest m_history_entry;
8383
solver::Solution m_solution;
8484

85+
/** Pair of current Python version, and potential update. */
8586
std::pair<std::string, std::string> m_py_versions;
87+
/**
88+
* The potential "python_site_package" entry.
89+
*
90+
* Found in the the new or installed python interpreter.
91+
* Key is added as part of CEP-17.
92+
* https://conda.org/learn/ceps/cep-0017
93+
*/
94+
std::string m_python_site_packages_path;
8695
std::vector<specs::MatchSpec> m_requested_specs;
8796

8897
MTransaction(const CommandParams& command_params, MultiPackageCache&);

libmamba/include/mamba/specs/build_number_spec.hpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,9 @@ namespace mamba::specs
124124
*/
125125
[[nodiscard]] auto contains(BuildNumber point) const -> bool;
126126

127-
// TODO(C++20): replace by the `= default` implementation of `operator==`
128-
[[nodiscard]] auto operator==(const BuildNumberSpec& other) const -> bool
129-
{
130-
return m_predicate == other.m_predicate;
131-
}
127+
[[nodiscard]] auto operator==(const BuildNumberSpec& other) const -> bool = default;
132128

133-
[[nodiscard]] auto operator!=(const BuildNumberSpec& other) const -> bool
134-
{
135-
return !(*this == other);
136-
}
129+
[[nodiscard]] auto operator!=(const BuildNumberSpec& other) const -> bool = default;
137130

138131
private:
139132

libmamba/include/mamba/specs/match_spec.hpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "mamba/specs/version_spec.hpp"
2424
#include "mamba/util/flat_set.hpp"
2525
#include "mamba/util/heap_optional.hpp"
26-
#include "mamba/util/tuple_hash.hpp"
2726

2827
namespace mamba::specs
2928
{
@@ -142,22 +141,15 @@ namespace mamba::specs
142141
*/
143142
[[nodiscard]] auto contains_except_channel(const PackageInfo& pkg) const -> bool;
144143

145-
// TODO(C++20): replace by the `= default` implementation of `operator==`
146-
[[nodiscard]] auto operator==(const MatchSpec& other) const -> bool
147-
{
148-
return m_channel == other.m_channel //
149-
&& m_version == other.m_version //
150-
&& m_name == other.m_name //
151-
&& m_build_string == other.m_build_string //
152-
&& m_name_space == other.m_name_space //
153-
&& m_build_number == other.m_build_number //
154-
&& m_extra == other.m_extra;
155-
}
144+
/**
145+
* Naive attribute-wise comparison.
146+
*
147+
* @warning Some complex matchspec could compare to false but actually represent the same
148+
* set of packages. This strong equality is hard to detect.
149+
*/
150+
[[nodiscard]] auto operator==(const MatchSpec& other) const -> bool = default;
156151

157-
[[nodiscard]] auto operator!=(const MatchSpec& other) const -> bool
158-
{
159-
return !(*this == other);
160-
}
152+
[[nodiscard]] auto operator!=(const MatchSpec& other) const -> bool = default;
161153

162154
auto extra_members_hash() const -> std::size_t;
163155

libmamba/include/mamba/specs/package_info.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ namespace mamba::specs
4747
std::string license = {};
4848
std::string md5 = {};
4949
std::string sha256 = {};
50+
std::string python_site_packages_path = {};
5051
std::string signatures = {};
5152
std::vector<std::string> track_features = {};
5253
std::vector<std::string> dependencies = {};

libmamba/include/mamba/specs/repo_data.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ namespace mamba::specs
6363
/** Optionally a SHA256 hash of the package archive. */
6464
std::optional<std::string> sha256 = {};
6565

66+
/** Optionally a path to the site-packages directory. */
67+
std::optional<std::string> python_site_packages_path = {};
68+
6669
/** A deprecated md5 hash. */
6770
std::optional<std::string> legacy_bz2_md5 = {};
6871

libmamba/src/core/query.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ namespace mamba
325325
fmt::print(out, fmtstring, "Track Features", fmt::join(pkg.track_features, ","));
326326
}
327327

328+
if (!pkg.python_site_packages_path.empty())
329+
{
330+
fmt::print(out, fmtstring, "Site-packages", pkg.python_site_packages_path);
331+
}
332+
328333
// std::cout << fmt::format<char>(
329334
// " {:<15} {:%Y-%m-%d %H:%M:%S} UTC\n", "Timestamp", fmt::gmtime(pkg.timestamp));
330335

0 commit comments

Comments
 (0)