unix: Include upip as fronzen modules inside the standard interpreter.

MicroPython doesn't come with standard library included, so it is important
to be able to easily install needed package in a seamless manner. Bundling
package manager (upip) inside an executable solves this issue.

upip is bundled only with standard executable, not "minimal" or "fast"
builds.
modussl
Paul Sokolovsky 2015-06-02 01:32:07 +03:00
parent 2fc1e64319
commit 9456732b86
4 changed files with 28 additions and 0 deletions

1
unix/.gitignore vendored
View File

@ -5,3 +5,4 @@ micropython
micropython_fast
micropython_minimal
*.py
micropython-upip-*

View File

@ -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/

View File

@ -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)

View File

@ -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)