return r;
}
+static int pakfire_build_find_python_abi_requires(
+ struct pakfire_ctx* ctx, struct pakfire_file* file, struct pakfire_find_deps_ctx* deps) {
+ char basename[PATH_MAX];
+ int r;
+
+ // Fetch the path
+ const char* path = pakfire_file_get_path(file);
+ if (!path)
+ return -EINVAL;
+
+ // Take the basename
+ r = pakfire_path_basename(basename, path);
+ if (r < 0)
+ return r;
+
+ // The basename must start with python
+ if (!pakfire_string_startswith(basename, "python"))
+ return -EINVAL;
+
+ // Add the dependency
+ return pakfire_package_add_dep(deps->pkg,
+ PAKFIRE_PKG_REQUIRES, "python-abi = %s", basename + strlen("python"));
+}
+
static int __pakfire_build_find_requires(
struct pakfire_ctx* ctx, struct pakfire_file* file, void* data) {
struct pakfire_find_deps_ctx* deps = data;
if (r < 0)
return r;
break;
+
+ // Directories
+ case S_IFDIR:
+ // Handle Python ABI
+ if (pakfire_path_match("/usr/lib*/python*", path)) {
+ r = pakfire_build_find_python_abi_requires(ctx, file, deps);
+ if (r < 0)
+ return r;
+ }
+
+ break;
}
return 0;
continue
fi
- # Process special files
- case "${file}" in
- # Python
- /usr/lib*/python*/*)
- # Fall through for all python files
- ;;
-
- # Catch the module directory
- /usr/lib*/python[0-9]\.[0-9]*)
- # This will only get the python directory
- file="$(basename "${file}")"
-
- # Strip the python version from the string
- python_version="${file#python}"
-
- if [ -n "${python_version}" ]; then
- echo "python-abi = ${python_version}"
- fi
- ;;
- esac
-
# Skip anything that isn't a regular file
if [ ! -f "${path}" ]; then
continue