diff --git a/unix/.gitignore b/unix/.gitignore index 4f07c70c78..59dee4d70b 100644 --- a/unix/.gitignore +++ b/unix/.gitignore @@ -5,3 +5,4 @@ micropython micropython_fast micropython_minimal *.py +micropython-upip-* diff --git a/unix/Makefile b/unix/Makefile index 2e4e679a3b..af85a36e3b 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -103,6 +103,13 @@ SRC_C = \ coverage.c \ $(SRC_MOD) +# Include builtin package manager in the standard build (and coverage) +ifeq ($(PROG),micropython) +SRC_C += $(BUILD)/_frozen_upip.c +else ifeq ($(PROG),micropython_coverage) +SRC_C += $(BUILD)/_frozen_upip.c +endif + LIB_SRC_C = $(addprefix lib/,\ $(LIB_SRC_C_EXTRA) \ ) @@ -153,3 +160,17 @@ coverage_test: coverage cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests --emit native gcov -o build-coverage/py ../py/*.c gcov -o build-coverage/extmod ../extmod/*.c + +$(BUILD)/_frozen_upip.c: frozen_upip/upip.py + ../tools/make-frozen.py frozen_upip > $@ + +# Select latest upip version available +UPIP_TARBALL := $(shell ls -1 -v ../tools/micropython-upip-*.tar.gz | tail -n1) + +frozen_upip/upip.py: $(UPIP_TARBALL) + $(Q)rm -rf micropython-upip-* + $(ECHO) "MISC Preparing upip as frozen module" + $(Q)tar xfz $^ + $(Q)rm -rf frozen_upip + $(Q)mkdir -p frozen_upip + $(Q)cp micropython-upip-*/upip*.py frozen_upip/ diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index 2a24061c9e..a0e7bf4674 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -81,6 +81,7 @@ #define MICROPY_PY_CMATH (1) #define MICROPY_PY_IO_FILEIO (1) #define MICROPY_PY_GC_COLLECT_RETVAL (1) +#define MICROPY_MODULE_FROZEN (1) #define MICROPY_STACKLESS (0) #define MICROPY_STACKLESS_STRICT (0) diff --git a/unix/mpconfigport_fast.h b/unix/mpconfigport_fast.h index 2dd55e42a5..0694b7099c 100644 --- a/unix/mpconfigport_fast.h +++ b/unix/mpconfigport_fast.h @@ -33,3 +33,8 @@ // 91 is a magic number proposed by @dpgeorge, which make pystone run ~ at tie // with CPython 3.4. #define MICROPY_MODULE_DICT_SIZE (91) + +// Don't include builtin upip, as this build is again intended just for +// synthetic benchmarking +#undef MICROPY_MODULE_FROZEN +#define MICROPY_MODULE_FROZEN (0)