From 414c2f9da610ab92e3d87e057fbe92d4afeeef4e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Oct 2021 14:59:04 -0500 Subject: [PATCH] Always use python3 .. similar to https://github.com/micropython/micropython/pull/4448 --- ports/atmel-samd/Makefile | 8 ++++---- ports/espressif/Makefile | 4 ++-- ports/litex/Makefile | 4 ++-- ports/mimxrt10xx/Makefile | 2 +- ports/nrf/Makefile | 4 ++-- ports/raspberrypi/Makefile | 10 +++++----- ports/stm/Makefile | 4 ++-- py/circuitpy_defns.mk | 2 +- py/mkenv.mk | 7 ++----- supervisor/supervisor.mk | 4 ++-- 10 files changed, 23 insertions(+), 26 deletions(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 0394224259..7b61bae267 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -364,11 +364,11 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) SRC_QSTR += $(HEADER_BUILD)/sdiodata.h $(HEADER_BUILD)/sdiodata.h: tools/mksdiodata.py | $(HEADER_BUILD) - $(Q)$(PYTHON3) $< > $@ + $(Q)$(PYTHON) $< > $@ SRC_QSTR += $(HEADER_BUILD)/candata.h $(HEADER_BUILD)/candata.h: tools/mkcandata.py | $(HEADER_BUILD) - $(Q)$(PYTHON3) $< > $@ + $(Q)$(PYTHON) $< > $@ SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) # Sources that only hold QSTRs after pre-processing. @@ -380,7 +380,7 @@ $(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE) $(STEPECHO) "LINK $@" $(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group - $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE) + $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE) $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" @@ -388,7 +388,7 @@ $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(BUILD)/firmware.uf2: $(BUILD)/firmware.bin $(STEPECHO) "Create $@" - $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $^ + $(Q)$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $^ include $(TOP)/py/mkrules.mk diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 1a6c3e6ba5..9a928b40f4 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -400,14 +400,14 @@ $(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py $(STEPECHO) "Create $@" $(Q)esptool.py --chip $(IDF_TARGET) elf2image $(FLASH_FLAGS) --elf-sha256-offset 0xb0 -o $@ $^ - $(Q)$(PYTHON3) tools/build_memory_info.py $< $(BUILD)/esp-idf/sdkconfig $@ + $(Q)$(PYTHON) tools/build_memory_info.py $< $(BUILD)/esp-idf/sdkconfig $@ $(BUILD)/firmware.bin: $(BUILD)/circuitpython-firmware.bin | esp-idf-stamp $(Q)$(PYTHON) ../../tools/join_bins.py $@ $(BOOTLOADER_OFFSET) $(BUILD)/esp-idf/bootloader/bootloader.bin $(PARTITION_TABLE_OFFSET) $(BUILD)/esp-idf/partition_table/partition-table.bin $(FIRMWARE_OFFSET) $(BUILD)/circuitpython-firmware.bin $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin $(STEPECHO) "Create $@" - $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ + $(Q)$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ flash: $(BUILD)/firmware.bin esptool.py --chip $(IDF_TARGET) -p $(PORT) $(ESPTOOL_FLAGS) write_flash $(FLASH_FLAGS) 0x0000 $^ diff --git a/ports/litex/Makefile b/ports/litex/Makefile index b4bc135dca..e483832fc1 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -169,7 +169,7 @@ all: $(BUILD)/firmware.bin $(BUILD)/firmware.dfu $(BUILD)/firmware.elf: $(OBJ) $(STEPECHO) "LINK $@" $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group - $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(LD_FILE) + $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LD_FILE) $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" @@ -183,7 +183,7 @@ $(BUILD)/firmware.hex: $(BUILD)/firmware.elf $(BUILD)/firmware.dfu: $(BUILD)/firmware.bin $(ECHO) "Create $@" - $(PYTHON3) $(TOP)/tools/dfu.py -b $^ -D 0x1209:0x5bf0 "$(BUILD)/firmware.dfu" + $(PYTHON) $(TOP)/tools/dfu.py -b $^ -D 0x1209:0x5bf0 "$(BUILD)/firmware.dfu" include $(TOP)/py/mkrules.mk diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 4ba6c7b20c..f330cddf14 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -207,7 +207,7 @@ $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(BUILD)/firmware.uf2: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" $(Q)$(OBJCOPY) -O binary -j .text -j .ARM.exidx -j .data -j .itcm -j .dtcm_data $^ $@-binpart - $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -f MIMXRT10XX -c -o $@ $@-binpart + $(Q)$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -f MIMXRT10XX -c -o $@ $@-binpart $(Q)rm $@-binpart $(BUILD)/firmware.hex: $(BUILD)/firmware.elf diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 01050324f5..acd1509297 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -239,7 +239,7 @@ $(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE) $(STEPECHO) "LINK $@" $(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group - $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE) + $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE) $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" @@ -257,7 +257,7 @@ $(BUILD)/firmware.combined.hex: $(BUILD)/firmware.hex $(SOFTDEV_HEX) $(BUILD)/firmware.uf2: $(BUILD)/firmware.hex $(ECHO) "Create $@" - $(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "$(BUILD)/firmware.uf2" $^ + $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "$(BUILD)/firmware.uf2" $^ diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index a370982a38..2739bf6547 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -249,7 +249,7 @@ $(BUILD)/boot2_padded_checksummed.o: $(BUILD)/boot2_padded_checksummed.S $(BUILD)/boot2_padded_checksummed.S: $(BUILD)/boot2.bin $(STEPECHO) "PAD_CHECKSUM $<" - $(Q)$(PYTHON3) sdk/src/rp2_common/boot_stage2/pad_checksum -s 0xffffffff $< $@ + $(Q)$(PYTHON) sdk/src/rp2_common/boot_stage2/pad_checksum -s 0xffffffff $< $@ $(BUILD)/boot2.bin: $(BUILD)/boot2.elf $(STEPECHO) "OBJCOPY $<" @@ -258,11 +258,11 @@ $(BUILD)/boot2.bin: $(BUILD)/boot2.elf $(BUILD)/stage2.c: stage2.c.jinja gen_stage2.py | $(BUILD)/ $(STEPECHO) "GEN $<" - $(Q)$(PYTHON3) gen_stage2.py $< $@ $(EXTERNAL_FLASH_DEVICES) + $(Q)$(PYTHON) gen_stage2.py $< $@ $(EXTERNAL_FLASH_DEVICES) $(HEADER_BUILD)/flash_info.h: flash_info.h.jinja gen_stage2.py | $(HEADER_BUILD)/ $(STEPECHO) "GEN $<" - $(Q)$(PYTHON3) gen_stage2.py $< $@ $(EXTERNAL_FLASH_DEVICES) + $(Q)$(PYTHON) gen_stage2.py $< $@ $(EXTERNAL_FLASH_DEVICES) $(BUILD)/supervisor/internal_flash.o: $(HEADER_BUILD)/flash_info.h @@ -280,7 +280,7 @@ $(BUILD)/firmware.elf: $(OBJ) link.ld $(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)echo $(PICO_LDFLAGS) > $(BUILD)/firmware.ldflags $(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags -Wl,-T,link.ld -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs - $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py link.ld + $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py link.ld $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" @@ -288,7 +288,7 @@ $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(BUILD)/firmware.uf2: $(BUILD)/firmware.bin $(STEPECHO) "Create $@" - $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xe48bff56 -b 0x10000000 -c -o $@ $^ + $(Q)$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xe48bff56 -b 0x10000000 -c -o $@ $^ include $(TOP)/py/mkrules.mk diff --git a/ports/stm/Makefile b/ports/stm/Makefile index c691044f27..b5423b62c0 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -290,7 +290,7 @@ $(BUILD)/firmware.elf: $(OBJ) $(STEPECHO) "LINK $@" $(Q)echo $^ > $(BUILD)/firmware.objs $(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group - $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(LD_FILE) + $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LD_FILE) $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" @@ -302,7 +302,7 @@ $(BUILD)/firmware.hex: $(BUILD)/firmware.elf $(BUILD)/firmware.uf2: $(BUILD)/firmware.hex $(ECHO) "Create $@" - $(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0x57755a57 -b $(BOOTLOADER_OFFSET) -c -o "$(BUILD)/firmware.uf2" $^ + $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f 0x57755a57 -b $(BOOTLOADER_OFFSET) -c -o "$(BUILD)/firmware.uf2" $^ flash: $(BUILD)/firmware.bin $(ECHO) "Writing $< to the board" diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 5f112b4dee..7d2d128a73 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -706,7 +706,7 @@ GENERATED_LD_FILE = $(BUILD)/$(notdir $(patsubst %.template.ld,%.ld,$(LD_TEMPLAT # because it may include other template files. $(GENERATED_LD_FILE): $(BUILD)/ld_defines.pp boards/*.template.ld $(STEPECHO) "GEN $@" - $(Q)$(PYTHON3) $(TOP)/tools/gen_ld_files.py --defines $< --out_dir $(BUILD) boards/*.template.ld + $(Q)$(PYTHON) $(TOP)/tools/gen_ld_files.py --defines $< --out_dir $(BUILD) boards/*.template.ld endif .PHONY: check-release-needs-clean-build diff --git a/py/mkenv.mk b/py/mkenv.mk index 9811876859..e2cdb2ddb6 100644 --- a/py/mkenv.mk +++ b/py/mkenv.mk @@ -46,16 +46,13 @@ CD = cd CP = cp FIND = find MKDIR = mkdir -PYTHON = python -# Set default python interpreters -PYTHON2 ?= $(which python2 || which python2.7) -PYTHON3 ?= python3 +PYTHON = python3 RM = rm RSYNC = rsync SED = sed TOUCH = touch # Linux has 'nproc', macOS has 'sysctl -n hw.logicalcpu', this is cross-platform -NPROC = $(PYTHON3) -c 'import multiprocessing as mp; print(mp.cpu_count())' +NPROC = $(PYTHON) -c 'import multiprocessing as mp; print(mp.cpu_count())' AS = $(CROSS_COMPILE)as CC = $(CROSS_COMPILE)gcc diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 7484c56092..6789ab32ea 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -65,7 +65,7 @@ else $(HEADER_BUILD)/devices.h : ../../supervisor/shared/external_flash/devices.h.jinja ../../tools/gen_nvm_devices.py | $(HEADER_BUILD) $(STEPECHO) "GEN $@" $(Q)install -d $(BUILD)/genhdr - $(Q)$(PYTHON3) ../../tools/gen_nvm_devices.py $< $@ + $(Q)$(PYTHON) ../../tools/gen_nvm_devices.py $< $@ $(BUILD)/supervisor/shared/external_flash/external_flash.o: $(HEADER_BUILD)/devices.h @@ -185,7 +185,7 @@ CIRCUITPY_DISPLAY_FONT ?= "../../tools/fonts/ter-u12n.bdf" $(BUILD)/autogen_display_resources.c: ../../tools/gen_display_resources.py $(HEADER_BUILD)/qstrdefs.generated.h Makefile | $(HEADER_BUILD) $(STEPECHO) "GEN $@" $(Q)install -d $(BUILD)/genhdr - $(Q)$(PYTHON3) ../../tools/gen_display_resources.py \ + $(Q)$(PYTHON) ../../tools/gen_display_resources.py \ --font $(CIRCUITPY_DISPLAY_FONT) \ --sample_file $(HEADER_BUILD)/qstrdefs.generated.h \ --output_c_file $(BUILD)/autogen_display_resources.c