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

[Minios-devel] [UNIKRAFT/PYTHON3 PATCH v2 11/13] Provide main() function if configured to do so


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Mon, 23 Sep 2019 12:47:12 +0300
  • Cc: felipe.huici@xxxxxxxxx, vlad_andrei.badoiu@xxxxxxxxxxxxxxx
  • Delivery-date: Mon, 23 Sep 2019 09:48:19 +0000
  • Ironport-phdr: 9a23:Vi3g/BFqv3+YKbAF+R8R1Z1GYnF86YWxBRYc798ds5kLTJ7ypM+wAkXT6L1XgUPTWs2DsrQY0rGQ6fCrADxIoc7Y9ixbKtoUD15NoP5VtjRoONSCB0z/IayiRA0BN+MGamVY+WqmO1NeAsf0ag6aiHSz6TkPBke3blItdaz6FYHIksu4yf259YHNbAVUnjq9Zq55IAmroQnLucQanIVvJrwvxhbKrXdEZudbzn5sKV6Pghrw/Mi98IN9/yhKp/4t68tMWrjmcqolSrBVEC4oOH0v6s3xshnDQwqP5n8CXWgTjxFFHQvL4gzkU5noqif1ufZz1yecPc3tULA7Qi+i4LtxSB/pkygIKTg0+3zKh8NqjaJbpBWhpwFjw4PRfYqYOuZycr/bcNgHQ2dKQ8RfWDFbAo6kb4UBEfcPM+hboYf6pVQOowCzCRWwCO711jNFnGP60bE83u88EQ/GxgsgH9cWvXnKq9X1L7sSUeGzzKLVyzvDcutW2Srg44XPbh8hpuqMXa5xccrX00UvEx7Fjk2NqYH+IzyVzf4Bs3CG7+V7T+6vkWknphh3rzOyxckskpHEip8ax1zZ7yl0w4Y4KcemREJlY9OoCpVduzmHO4Z5X88uWWJltSYgxrEYt5O2cjIGxIkoyhLBbfGMbpKG7Qj5VOmLJDd1nHdleLWiiBms6UWg0ej8VtWs0FZNsypFjsHAtnAT2BzX7ciKUuV9/kK71jaO0wDf8P1LIVsumarDNp4u2aQ8loAUsUjbHy/2nlv5jLOOe0k59eWk9v7rb7bmq5OGKYN4lAPzPr4gl8CnBOQ3KAkOX2yV+eSm073j+FX0T6lNjv0tjqnZsZbaKd4fpq6kGw9Vz50u5AqkDzu8yNQYgGIIIEhfeBKAl4TpIU3BIOjkDfejhFShiDJrx/HAPr3gBZXNNWHPn6r/crZj9UFczBE+zdRe55JPFrEBO+j/W0Dvu9zeFBM5NBa0w+n/AtVnyoweQX6PArOeMK7Kv1+H+OYvI+iUZIALojr9K+Ul5//ygn84glIde7em0ocTaH+iBftqOVuWYWf0iNcbDWgKphY+TPDtiFCaTz5TY2y9UL8k6T4hDoKpEJ3DSZ6sgLCbxyi0BIBZZmdHClCRCnrobJmEW+oRZy6IOMBujicEWaK8S485zh6irhX6y700ZtbTrygZs5Pkz5156vPekTk29CdoFIKN3mfLSHt7zU0SQDpj96dkvU17gnOeybUw1/dfDsBS4bVNTx8nHZXHifRnAZboXVSSLZ+yVF+6T4D+UnkKRdUrzopWbg==
  • Ironport-sdr: XQV6BqismlhchcNVv8Wic27PNHiIcG9nk7RpSjBf/Htk1sfDQNBtLjP6UOjou8OyU30K67wwuP veNkcbbgYrqw==
  • 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®.