From a06c05a7b3e5b40f5468a37005437d5ab89038b3 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Thu, 11 Oct 2018 13:19:33 -0500 Subject: [PATCH 1/6] add support for testing/adding other exts this commit adds support for additional extensions to be automaticly included by the makefile chain --- python_build/Makefile | 2 ++ python_exts/SetupExtensions.sh | 13 +++++++++++++ python_exts/c_files/.dont_delete | 0 python_exts/setup/.dont_delete | 0 4 files changed, 15 insertions(+) create mode 100755 python_exts/SetupExtensions.sh create mode 100644 python_exts/c_files/.dont_delete create mode 100644 python_exts/setup/.dont_delete diff --git a/python_build/Makefile b/python_build/Makefile index 74bee60..2793709 100644 --- a/python_build/Makefile +++ b/python_build/Makefile @@ -38,6 +38,7 @@ else endif PYCONFIG_DIR := ../python_config +PY_EXT_DIR := ../python_exts LIBDIRS := $(PORTLIBS) $(LIBNX) export INCLUDE := $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ @@ -135,6 +136,7 @@ patchPY: cloneNX extractedPY cp $(PYDIR)/Modules/Setup.dist $(PYDIR)/Modules/Setup.dist_old cat $(PYDIR)/Modules/Setup.dist_old | $(SED) -e '$$a_nx -I$$(srcdir)/Modules/_nx _nx/_nxmodule.c hashtable.c' | $(SED) 's/^\([^#].* pwdmodule\.c.*\)/#\1/' | $(SED) 's/^#\(array\|cmath\|math\|_struct\|operator\|_random\|_collections\|itertools\|signal\|strop\|unicodedata\|_io\|_csv\|_md5\|_sha\|_sha256\|_sha512\|binascii\|select\|cStringIO\|time\|_functools\|_socket\|datetime\|_bisect\|zlib\)\(.*\)/\1\2/' | $(SED) "s#\\(zlib[^\$$]*\\)\$$(prefix)\\([^\$$]*\\)\$$(exec_prefix)\\(.*\\)#\1$(DEVKITPRO)/portlibs/switch\2$(DEVKITPRO)/portlibs/switch\3#" | $(SED) "s/_tracemalloc/# _tracemalloc/" >$(PYDIR)/Modules/Setup.dist cat imgui-switch-*/setup.txt >> $(PYDIR)/Modules/Setup.dist + TOPDIR=$(TOPDIR) PYDIR=$(PYDIR) PY_EXT_DIR=$(PY_EXT_DIR) $(PY_EXT_DIR)/SetupExtensions.sh cp -r _nx-*/_nx $(PYDIR)/Modules/ cp -r imgui-switch-*/dist/modules/* $(PYDIR)/Modules/ diff --git a/python_exts/SetupExtensions.sh b/python_exts/SetupExtensions.sh new file mode 100755 index 0000000..c922f3b --- /dev/null +++ b/python_exts/SetupExtensions.sh @@ -0,0 +1,13 @@ +#!/bin/bash +echo $PWD +files=$(ls $TOPDIR/python_exts/setup/* 2>/dev/null | wc -l) +if [ $files != "0" ]; then + for i in $TOPDIR/python_exts/setup/*; do + echo $i + cat $i >>$TOPDIR/python_build/$PYDIR/Modules/Setup.dist + done +fi +files2=$(ls $TOPDIR/python_exts/c_files/* 2>/dev/null | wc -l) +if [ $files2 != "0" ]; then + cp $TOPDIR/python_exts/c_files/* $TOPDIR/python_build/$PYDIR/Modules/ +fi diff --git a/python_exts/c_files/.dont_delete b/python_exts/c_files/.dont_delete new file mode 100644 index 0000000..e69de29 diff --git a/python_exts/setup/.dont_delete b/python_exts/setup/.dont_delete new file mode 100644 index 0000000..e69de29 From 2c0be531117d50c2ea2d7d4876964ef2b29f201c Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Sat, 13 Oct 2018 21:11:31 -0500 Subject: [PATCH 2/6] allow recursive copying of the c files --- python_exts/SetupExtensions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_exts/SetupExtensions.sh b/python_exts/SetupExtensions.sh index c922f3b..85eff80 100755 --- a/python_exts/SetupExtensions.sh +++ b/python_exts/SetupExtensions.sh @@ -9,5 +9,5 @@ if [ $files != "0" ]; then fi files2=$(ls $TOPDIR/python_exts/c_files/* 2>/dev/null | wc -l) if [ $files2 != "0" ]; then - cp $TOPDIR/python_exts/c_files/* $TOPDIR/python_build/$PYDIR/Modules/ + cp -r $TOPDIR/python_exts/c_files/* $TOPDIR/python_build/$PYDIR/Modules/ fi From 3d3912636c4153d134bb2c3a48774c6253365620 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Thu, 1 Nov 2018 15:43:28 -0500 Subject: [PATCH 3/6] rename to git keep --- .gitignore | 1 + python_exts/c_files/{.dont_delete => .gitkeep} | 0 python_exts/setup/{.dont_delete => .gitkeep} | 0 3 files changed, 1 insertion(+) rename python_exts/c_files/{.dont_delete => .gitkeep} (100%) rename python_exts/setup/{.dont_delete => .gitkeep} (100%) diff --git a/.gitignore b/.gitignore index 974c849..c214272 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ python_build/* !python_build/Makefile build/ PyNX.* +.DS_Store diff --git a/python_exts/c_files/.dont_delete b/python_exts/c_files/.gitkeep similarity index 100% rename from python_exts/c_files/.dont_delete rename to python_exts/c_files/.gitkeep diff --git a/python_exts/setup/.dont_delete b/python_exts/setup/.gitkeep similarity index 100% rename from python_exts/setup/.dont_delete rename to python_exts/setup/.gitkeep From 564aef61d8a4b1602e7da2db5058985acfd62f97 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Thu, 1 Nov 2018 16:13:01 -0500 Subject: [PATCH 4/6] remove shell script --- python_build/Makefile | 3 ++- python_exts/SetupExtensions.sh | 13 ------------- 2 files changed, 2 insertions(+), 14 deletions(-) delete mode 100755 python_exts/SetupExtensions.sh diff --git a/python_build/Makefile b/python_build/Makefile index 2793709..f04a5ac 100644 --- a/python_build/Makefile +++ b/python_build/Makefile @@ -136,7 +136,8 @@ patchPY: cloneNX extractedPY cp $(PYDIR)/Modules/Setup.dist $(PYDIR)/Modules/Setup.dist_old cat $(PYDIR)/Modules/Setup.dist_old | $(SED) -e '$$a_nx -I$$(srcdir)/Modules/_nx _nx/_nxmodule.c hashtable.c' | $(SED) 's/^\([^#].* pwdmodule\.c.*\)/#\1/' | $(SED) 's/^#\(array\|cmath\|math\|_struct\|operator\|_random\|_collections\|itertools\|signal\|strop\|unicodedata\|_io\|_csv\|_md5\|_sha\|_sha256\|_sha512\|binascii\|select\|cStringIO\|time\|_functools\|_socket\|datetime\|_bisect\|zlib\)\(.*\)/\1\2/' | $(SED) "s#\\(zlib[^\$$]*\\)\$$(prefix)\\([^\$$]*\\)\$$(exec_prefix)\\(.*\\)#\1$(DEVKITPRO)/portlibs/switch\2$(DEVKITPRO)/portlibs/switch\3#" | $(SED) "s/_tracemalloc/# _tracemalloc/" >$(PYDIR)/Modules/Setup.dist cat imgui-switch-*/setup.txt >> $(PYDIR)/Modules/Setup.dist - TOPDIR=$(TOPDIR) PYDIR=$(PYDIR) PY_EXT_DIR=$(PY_EXT_DIR) $(PY_EXT_DIR)/SetupExtensions.sh + cp -r $(TOPDIR)/python_exts/c_files/. $(TOPDIR)/python_build/$(PYDIR)/Modules/ + cat $(TOPDIR)/python_exts/setup/* >>$(TOPDIR)/python_build/$(PYDIR)/Modules/Setup.dist cp -r _nx-*/_nx $(PYDIR)/Modules/ cp -r imgui-switch-*/dist/modules/* $(PYDIR)/Modules/ diff --git a/python_exts/SetupExtensions.sh b/python_exts/SetupExtensions.sh deleted file mode 100755 index 85eff80..0000000 --- a/python_exts/SetupExtensions.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -echo $PWD -files=$(ls $TOPDIR/python_exts/setup/* 2>/dev/null | wc -l) -if [ $files != "0" ]; then - for i in $TOPDIR/python_exts/setup/*; do - echo $i - cat $i >>$TOPDIR/python_build/$PYDIR/Modules/Setup.dist - done -fi -files2=$(ls $TOPDIR/python_exts/c_files/* 2>/dev/null | wc -l) -if [ $files2 != "0" ]; then - cp -r $TOPDIR/python_exts/c_files/* $TOPDIR/python_build/$PYDIR/Modules/ -fi From fc3f57e9fb390ad9093ec21b018e0e977dbf58da Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Thu, 1 Nov 2018 16:18:49 -0500 Subject: [PATCH 5/6] add gitkeep to pylibs --- python_exts/py_libs/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 python_exts/py_libs/.gitkeep diff --git a/python_exts/py_libs/.gitkeep b/python_exts/py_libs/.gitkeep new file mode 100644 index 0000000..e69de29 From 979abb66700ed6bf6f25f3d32ada4998c8208950 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Thu, 1 Nov 2018 16:20:00 -0500 Subject: [PATCH 6/6] add code to copy python libs into dist --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index f3426e6..57333fd 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,7 @@ dist: $(BUILD) unzip $(PY_BUILD)/nxpy3.5.3/python.zip -d $(LIBDIR) cp -r $(PY_BUILD)/nx-*/nx $(LIBDIR) cp -r $(PY_BUILD)/imgui-switch-*/dist/python/* $(LIBDIR) + cp -r python_exts/py_libs/* $(LIBDIR) cp $(OUTPUT).nro $(DIST_DIR)/ cp $(OUTPUT).nacp $(DIST_DIR)/ cp main.py $(DIST_DIR)/