From b1c0355b9359b0a63e08d9e5f33755f5919a6b8e Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 10 Sep 2019 00:50:04 +1000 Subject: [PATCH] unix: Convert to use FROZEN_MANIFEST to specify frozen code. Removes symlinks in modules directory, all frozen code is now specified by manifest.py. --- ports/unix/Makefile | 16 +++++++++------- ports/unix/manifest.py | 2 ++ ports/unix/manifest_coverage.py | 2 ++ ports/unix/modules/upip.py | 1 - ports/unix/modules/upip_utarfile.py | 1 - 5 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 ports/unix/manifest.py create mode 100644 ports/unix/manifest_coverage.py delete mode 120000 ports/unix/modules/upip.py delete mode 120000 ports/unix/modules/upip_utarfile.py diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 134502b4da..b840856ffa 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -1,8 +1,10 @@ -include mpconfigport.mk include ../../py/mkenv.mk -FROZEN_DIR = scripts -FROZEN_MPY_DIR = modules +# use FROZEN_MANIFEST for new projects, others are legacy +FROZEN_MANIFEST ?= manifest.py +FROZEN_DIR = +FROZEN_MPY_DIR = # define main target PROG = micropython @@ -177,9 +179,9 @@ SRC_QSTR += $(SRC_C) $(LIB_SRC_C) # SRC_QSTR SRC_QSTR_AUTO_DEPS += -ifneq ($(FROZEN_MPY_DIR),) -# To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and -# then invoke make with FROZEN_MPY_DIR=frozen (be sure to build from scratch). +ifneq ($(FROZEN_MANIFEST)$(FROZEN_MPY_DIR),) +# To use frozen code create a manifest.py file with a description of files to +# freeze, then invoke make with FROZEN_MANIFEST=manifest.py (be sure to build from scratch). CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool CFLAGS += -DMICROPY_MODULE_FROZEN_MPY CFLAGS += -DMPZ_DIG_SIZE=16 # force 16 bits to work on both 32 and 64 bit archs @@ -215,7 +217,7 @@ fast: # build a minimal interpreter minimal: $(MAKE) COPT="-Os -DNDEBUG" CFLAGS_EXTRA='-DMP_CONFIGFILE=""' \ - BUILD=build-minimal PROG=micropython_minimal FROZEN_DIR= FROZEN_MPY_DIR= \ + BUILD=build-minimal PROG=micropython_minimal FROZEN_MANIFEST= \ MICROPY_PY_BTREE=0 MICROPY_PY_FFI=0 MICROPY_PY_SOCKET=0 MICROPY_PY_THREAD=0 \ MICROPY_PY_TERMIOS=0 MICROPY_PY_USSL=0 \ MICROPY_USE_READLINE=0 @@ -252,7 +254,7 @@ coverage: -Wold-style-definition -Wpointer-arith -Wshadow -Wuninitialized -Wunused-parameter \ -DMICROPY_UNIX_COVERAGE' \ LDFLAGS_EXTRA='-fprofile-arcs -ftest-coverage' \ - FROZEN_DIR=coverage-frzstr FROZEN_MPY_DIR=coverage-frzmpy \ + FROZEN_MANIFEST=manifest_coverage.py \ BUILD=build-coverage PROG=micropython_coverage coverage_test: coverage diff --git a/ports/unix/manifest.py b/ports/unix/manifest.py new file mode 100644 index 0000000000..3f332446d1 --- /dev/null +++ b/ports/unix/manifest.py @@ -0,0 +1,2 @@ +freeze_as_mpy('$(MPY)/tools', 'upip.py') +freeze_as_mpy('$(MPY)/tools', 'upip_utarfile.py', opt=3) diff --git a/ports/unix/manifest_coverage.py b/ports/unix/manifest_coverage.py new file mode 100644 index 0000000000..0c32d08578 --- /dev/null +++ b/ports/unix/manifest_coverage.py @@ -0,0 +1,2 @@ +freeze_as_str('coverage-frzstr') +freeze_as_mpy('coverage-frzmpy') diff --git a/ports/unix/modules/upip.py b/ports/unix/modules/upip.py deleted file mode 120000 index 130eb69016..0000000000 --- a/ports/unix/modules/upip.py +++ /dev/null @@ -1 +0,0 @@ -../../../tools/upip.py \ No newline at end of file diff --git a/ports/unix/modules/upip_utarfile.py b/ports/unix/modules/upip_utarfile.py deleted file mode 120000 index d9653d6a60..0000000000 --- a/ports/unix/modules/upip_utarfile.py +++ /dev/null @@ -1 +0,0 @@ -../../../tools/upip_utarfile.py \ No newline at end of file