Py_RETURN_NONE;
}
-static PyObject* Pakfire_read_makefile(PakfireObject* self, PyObject* args) {
- const char* path = NULL;
-
- if (!PyArg_ParseTuple(args, "s", &path))
- return NULL;
-
- PakfireParser parser = NULL;
- struct pakfire_parser_error* error = NULL;
-
- int r = pakfire_read_makefile(&parser, self->pakfire, path, &error);
-
- // The parser could not parse the makefile
- if (r == 1) {
- PyErr_SetString(PyExc_SyntaxError, pakfire_parser_error_get_message(error));
- PyErr_SyntaxLocation(
- pakfire_parser_error_get_filename(error),
- pakfire_parser_error_get_line(error)
- );
- return NULL;
-
- // Handle any other internal error
- } else if (r < 0) {
- PyErr_SetFromErrno(PyExc_OSError);
- return NULL;
- }
-
- PyObject* ret = new_parser(parser);
- if (!ret)
- return NULL;
-
- pakfire_parser_unref(parser);
- if (error)
- pakfire_parser_error_unref(error);
-
- return ret;
-}
-
static PyObject* Pakfire_dist(PakfireObject* self, PyObject* args) {
const char* path = NULL;
const char* target = NULL;
METH_VARARGS|METH_KEYWORDS,
NULL,
},
- {
- "read_makefile",
- (PyCFunction)Pakfire_read_makefile,
- METH_VARARGS,
- NULL
- },
{
"refresh",
(PyCFunction)Pakfire_refresh,
return 0;
}
-PAKFIRE_EXPORT int pakfire_read_makefile(PakfireParser* parser, Pakfire pakfire,
+int pakfire_read_makefile(PakfireParser* parser, Pakfire pakfire,
const char* path, struct pakfire_parser_error** error) {
int r = 1;
int pakfire_dist(Pakfire pakfire, const char* path, const char* target);
+#ifdef PAKFIRE_PRIVATE
+
+#include <pakfire/parser.h>
+
+int pakfire_read_makefile(PakfireParser* parser, Pakfire pakfire,
+ const char* path, struct pakfire_parser_error** error);
+
+#endif
+
#endif /* PAKFIRE_DIST_H */
int pakfire_log_get_priority(Pakfire pakfire);
void pakfire_log_set_priority(Pakfire pakfire, int priority);
-// Build
-
-int pakfire_read_makefile(PakfireParser* parser, Pakfire pakfire, const char* path,
- struct pakfire_parser_error** error);
-
// Install/Erase/Update
int pakfire_install(Pakfire pakfire, const char** packages, int flags, int* changed);