aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-08-20 10:29:58 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-08-20 10:29:58 -0400
commit41eb56a04a808b6fdf1a18a93466f0586d161820 (patch)
tree7dafe6cef56b7045e905ef2a805fa3a8a9b9125a
parentc3585a2ef4e5a8624e3d0d3c9ecdb776993ee567 (diff)
downloadstasis-41eb56a04a808b6fdf1a18a93466f0586d161820.tar.gz
Rename python_package_exists to pip_index_provides
* Document the function prototype * Add missing comments in micromamba structure
-rw-r--r--include/conda.h13
-rw-r--r--src/conda.c2
-rw-r--r--src/delivery.c2
3 files changed, 12 insertions, 5 deletions
diff --git a/include/conda.h b/include/conda.h
index 169bc58..c546672 100644
--- a/include/conda.h
+++ b/include/conda.h
@@ -10,8 +10,8 @@
#define PYPI_INDEX_DEFAULT "https://pypi.org/simple"
struct MicromambaInfo {
- char *micromamba_prefix;
- char *conda_prefix;
+ char *micromamba_prefix; //!< Path to write micromamba binary
+ char *conda_prefix; //!< Path to install conda base tree
};
/**
@@ -183,6 +183,13 @@ int conda_env_export(char *name, char *output_dir, char *output_filename);
*/
int conda_index(const char *path);
-int python_package_exists(const char *index_url, const char *name, const char *version);
+/**
+ * Determine whether a simple index contains a package
+ * @param index_url a file system path or url pointing to a simple index
+ * @param name package name (required)
+ * @param version package version (may be NULL)
+ * @return not found = 0, found = 1, error = -1
+ */
+int pip_index_provides(const char *index_url, const char *name, const char *version);
#endif //STASIS_CONDA_H
diff --git a/src/conda.c b/src/conda.c
index 613a57f..f7c7250 100644
--- a/src/conda.c
+++ b/src/conda.c
@@ -79,7 +79,7 @@ int pip_exec(const char *args) {
return system(command);
}
-int python_package_exists(const char *index_url, const char *name, const char *version) {
+int pip_index_provides(const char *index_url, const char *name, const char *version) {
char cmd[PATH_MAX] = {0};
char name_local[255];
char version_local[255] = {0};
diff --git a/src/delivery.c b/src/delivery.c
index 2b69ec3..524dd0a 100644
--- a/src/delivery.c
+++ b/src/delivery.c
@@ -1504,7 +1504,7 @@ void delivery_defer_packages(struct Delivery *ctx, int type) {
}
}
- if (DEFER_PIP == type && python_package_exists(PYPI_INDEX_DEFAULT, name, version)) {
+ if (DEFER_PIP == type && pip_index_provides(PYPI_INDEX_DEFAULT, name, version)) {
fprintf(stderr, "(%s present on index %s): ", version, PYPI_INDEX_DEFAULT);
ignore_pkg = 0;
} else {