File tree 7 files changed +46
-0
lines changed
7 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ namespace solv
53
53
auto build_string () const -> std::string_view;
54
54
auto file_name () const -> std::string_view;
55
55
auto license () const -> std::string_view;
56
+ auto python_site_packages_path () const -> std::string_view;
56
57
auto md5 () const -> std::string_view;
57
58
auto noarch () const -> std::string_view;
58
59
auto sha256 () const -> std::string_view;
@@ -168,6 +169,17 @@ namespace solv
168
169
void set_license (raw_str_view str) const ;
169
170
void set_license (const std::string& str) const ;
170
171
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
+
171
183
/* *
172
184
* Set the md5 hash of the solvable file.
173
185
*
Original file line number Diff line number Diff line change @@ -206,6 +206,21 @@ namespace solv
206
206
return set_license (str.c_str ());
207
207
}
208
208
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
+ void ObjSolvableView::set_python_site_packages_path (raw_str_view str) const
215
+ {
216
+ ::solvable_set_str (raw(), SOLVABLE_MEDIABASE, str);
217
+ }
218
+
219
+ void ObjSolvableView::set_python_site_packages_path (const std::string& str) const
220
+ {
221
+ return set_python_site_packages_path (str.c_str ());
222
+ }
223
+
209
224
auto ObjSolvableViewConst::md5 () const -> std::string_view
210
225
{
211
226
::Id type = 0 ;
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ namespace mamba::specs
46
46
std::string license = {};
47
47
std::string md5 = {};
48
48
std::string sha256 = {};
49
+ std::string python_site_packages_path = {};
49
50
std::string signatures = {};
50
51
std::vector<std::string> track_features = {};
51
52
std::vector<std::string> dependencies = {};
Original file line number Diff line number Diff line change @@ -63,6 +63,9 @@ namespace mamba::specs
63
63
/* * Optionally a SHA256 hash of the package archive. */
64
64
std::optional<std::string> sha256 = {};
65
65
66
+ /* * Optionally a path to the site-packages directory. */
67
+ std::optional<std::string> python_site_packages_path = {};
68
+
66
69
/* * A deprecated md5 hash. */
67
70
std::optional<std::string> legacy_bz2_md5 = {};
68
71
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ namespace mamba::solver::libsolv
69
69
);
70
70
solv.set_md5 (pkg.md5 );
71
71
solv.set_sha256 (pkg.sha256 );
72
+ solv.set_python_site_packages_path (pkg.python_site_packages_path );
72
73
73
74
for (const auto & dep : pkg.dependencies )
74
75
{
@@ -110,6 +111,7 @@ namespace mamba::solver::libsolv
110
111
out.timestamp = s.timestamp ();
111
112
out.md5 = s.md5 ();
112
113
out.sha256 = s.sha256 ();
114
+ out.python_site_packages_path = s.python_site_packages_path ();
113
115
out.signatures = s.signatures ();
114
116
115
117
const auto dep_to_str = [&pool](solv::DependencyId id)
@@ -265,6 +267,11 @@ namespace mamba::solver::libsolv
265
267
solv.set_sha256 (sha256.value_unsafe ());
266
268
}
267
269
270
+ if (auto python_site_packages_path = pkg[" python_site_packages_path" ].get_c_str (); !python_site_packages_path.error ())
271
+ {
272
+ solv.set_python_site_packages_path (python_site_packages_path.value_unsafe ());
273
+ }
274
+
268
275
if (auto elem = pkg[" noarch" ]; !elem.error ())
269
276
{
270
277
if (auto val = elem.get_bool (); !val.error () && val.value_unsafe ())
Original file line number Diff line number Diff line change @@ -337,6 +337,7 @@ namespace mamba::specs
337
337
p.dependencies ,
338
338
p.constrains ,
339
339
p.signatures ,
340
+ p.python_site_packages_path ,
340
341
p.defaulted_keys
341
342
);
342
343
}
@@ -383,6 +384,10 @@ namespace mamba::specs
383
384
{
384
385
j[" signatures" ] = pkg.signatures ;
385
386
}
387
+ if (!pkg.python_site_packages_path .empty ())
388
+ {
389
+ j[" python_site_packages_path" ] = pkg.python_site_packages_path ;
390
+ }
386
391
if (pkg.dependencies .empty ())
387
392
{
388
393
j[" depends" ] = nlohmann::json::array ();
@@ -425,6 +430,7 @@ namespace mamba::specs
425
430
pkg.md5 = j.value (" md5" , " " );
426
431
pkg.sha256 = j.value (" sha256" , " " );
427
432
pkg.signatures = j.value (" signatures" , " " );
433
+ pkg.python_site_packages_path = j.value (" python_site_packages_path" , " " );
428
434
if (auto it = j.find (" track_features" ); it != j.end ())
429
435
{
430
436
if (it->is_string () && !it->get <std::string_view>().empty ())
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ namespace mamba::specs
22
22
j[" subdir" ] = p.subdir ;
23
23
j[" md5" ] = p.md5 ;
24
24
j[" sha256" ] = p.sha256 ;
25
+ j[" python_site_packages_path" ] = p.python_site_packages_path ;
25
26
j[" legacy_bz2_md5" ] = p.legacy_bz2_md5 ;
26
27
j[" legacy_bz2_size" ] = p.legacy_bz2_size ;
27
28
j[" size" ] = p.size ;
@@ -50,6 +51,7 @@ namespace mamba::specs
50
51
deserialize_maybe_missing (j, " subdir" , p.subdir );
51
52
deserialize_maybe_missing (j, " md5" , p.md5 );
52
53
deserialize_maybe_missing (j, " sha256" , p.sha256 );
54
+ deserialize_maybe_missing (j, " python_site_packages_path" , p.python_site_packages_path );
53
55
deserialize_maybe_missing (j, " legacy_bz2_md5" , p.legacy_bz2_md5 );
54
56
deserialize_maybe_missing (j, " legacy_bz2_size" , p.legacy_bz2_size );
55
57
deserialize_maybe_missing (j, " size" , p.size );
You can’t perform that action at this time.
0 commit comments