[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/PYTHON3 PATCH v3 12/14] Provide main() function if configured to do so


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Mon, 23 Sep 2019 12:58:50 +0300
  • Cc: felipe.huici@xxxxxxxxx, vlad_andrei.badoiu@xxxxxxxxxxxxxxx
  • Delivery-date: Mon, 23 Sep 2019 09:59:21 +0000
  • Ironport-phdr: 9a23:TUD9ihWtuiYWYpe0MgbU2s8X7rLV8LGtZVwlr6E/grcLSJyIuqrYbReEt8tkgFKBZ4jH8fUM07OQ7/m7HzZQqszZ+DBaKdoQDkVD0Z1X1yUbQ+e9QXXhK/DrayFoVO9jb3RCu0+BDE5OBczlbEfTqHDhpRQbGxH4KBYnbr+tQt2agMu4zf299IPOaAtUmjW9falyLBKrpgnNq8Uam4RvJrs/xxfTvHdFeOtayX10KVmOmxrw+tq88IRs/ihNpf4t7dJMXbn/c68lUbFWETMqPnwv6sb2rxfDVwyP5nUdUmUSjBVFBhXO4Q/5UJnsrCb0r/Jx1yaGM8L4S7A0Qimi4LxwSBD0kicHNiU2/3/Rh8dtka9UuhOhpxh4w47JfIGYMed1c63Bcd8GQ2dKQ8BcXDFDDIyhdYsCF+oPM/hFoYfzpFUAqhmxBQe3Ce/z1jNFnGP60Lcm3+g9FwzNwQwuH8gJsHTRtNj4KqASUfupzKnJyzXIcvVY2Srl6IjVbxsspu2DXbVrccrNyEkvERnJjlGNqYz9IjOYzfgCs3OB4+p4SOKgkHQrqxt2ojW2wMonl4rHhpoNx1zZ+ih13Zw5KN64RUJhf9KoDplduzuUOoduX88vTHxktDw5x7AGo5K3YiYHxZo9yxLCZPGLbY6F6Q/5WumLOzd3nndldaq6hxa17Eev1PXxVtKx0FZWtipFlcTMtmwV2xzT9MeHTvx981+/2TaKzQ/T6+VELVoomqrAMZIh2qMwmYEJvUTZGS/6gET2jKmIeUU44uWk9uvqbqj8qpKfN4J4kB/yProsl8ClD+k0Kg0OUHKa+eS42r3j50r5QLBSg/IqlanZq4zaJcUdpqKjBw9Vz54j6wukAji6y9QUh2EHLE9edx6dlYjpPEnCIOrkAvenn1SsjDBryujDPr3gBJXNL3/DkKz4cblg9UFc1hQ8zdRE6pJQC7EBO+7zWlTruN3XEBA5NRa4w+H9CNVyzokeQ36AAreFMKPOtl+F/uwvLPeIZI8UoDbyNeIp5/7zjX84hVAdfLKk3Z0JZ3+kGvRpOV6WbWDyjdccCW0KpBYxTPT2iF2eVj5ef2iyX6Ym6T4mEI2pF4HDSZ23gLOf3Se3BIZZaXpbBVCLEHfoap6JW+wQaCKPP8BtiCYLWqS6S4M7yBGurBT1x6B9LurTqWUkssfm1d504PaWmRws+DhcC8WGz3rLX2xy2GQSSGwYxqd69Gd60UuC1+BcnuRFXYhY4OhVUwF8MYPE0sRxEJbqRwiHZNDfGwXuecmvHTxkFoF5+NQJeUsoQ9g=
  • Ironport-sdr: PxSn7GTqLpwdMd7E5GE0wImdwyFQWIv6bcO9voiE0KAYkZ85NNSDHxrbSq3gIPDqtU4/aL+HhL cUiQ+UxZy4TQ==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.