|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT/PYTHON3 PATCH v3 12/14] Provide main() function if configured to do so
Hi Costin,
You have a grammar error in your commit message...other than that this patch
looks good, I'll give it a reviewed-by but please don't forget to fix this in
the next version.
-- Felipe
Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>
On 23.09.19, 11:59, "Costin Lupu" <costin.lupu@xxxxxxxxx> wrote:
Sometimes all you want to run is the Python shell. In this case you can
tick the
option in menuconfig so that the library to provide the main() function for
you.
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
Config.uk | 4 ++++
Makefile.uk | 1 +
main.c | 8 ++++++++
3 files changed, 13 insertions(+)
create mode 100644 main.c
diff --git a/Config.uk b/Config.uk
index 3da3ffb..80a557a 100644
--- a/Config.uk
+++ b/Config.uk
@@ -31,4 +31,8 @@ config LIBPYTHON3_TMPDIR
string "Temp directory location"
default "/tmp"
+config LIBPYTHON3_MAIN_FUNCTION
+ bool "Provide main function"
+ default n
+
endif
diff --git a/Makefile.uk b/Makefile.uk
index 8bc3acd..be2ff23 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -100,6 +100,7 @@ LIBPYTHON3_CXXINCLUDES-y +=
$(LIBPYTHON3_COMMON_INCLUDES-y)
LIBPYTHON3_SRCS-y += $(LIBPYTHON3_BASE)/init.c|unikraft
LIBPYTHON3_SRCS-y += $(LIBPYTHON3_BASE)/modules_config.c|unikraft
LIBPYTHON3_SRCS-y += $(LIBPYTHON3_BASE)/stubs.c|unikraft
+LIBPYTHON3_SRCS-$(CONFIG_LIBPYTHON3_MAIN_FUNCTION) +=
$(LIBPYTHON3_BASE)/main.c|unikraft
################################################################################
# Python core
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..a79df2c
--- /dev/null
+++ b/main.c
@@ -0,0 +1,8 @@
+#define Py_BUILD_CORE
+#include <Python.h>
+
+int main(int argc, char *argv[])
+{
+ return _Py_UnixMain(argc, argv);
+}
+
--
2.20.1
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |