Skip to content

update mc-apply.py #27628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 8, 2025
Merged

Conversation

ellensp
Copy link
Contributor

@ellensp ellensp commented Jan 7, 2025

Description

mc-apply.py no longer works with current CONFIG_EXPORT type 1

re wrote almost all of it from scratch so now it works.

Added help and documentation
extended to take a path to the input file on command line, but defaults to still looking for marlin_config.json in the current working directory

Requirements

use mc-apply.py

Benefits

  • Produces requested files
  • Updates Configuration.h and Configuration_adv.h
  • A lot more readable
  • Actually useful errors

Related Issues

@thisiskeithb thisiskeithb linked an issue Jan 7, 2025 that may be closed by this pull request
1 task
@thinkyhead
Copy link
Member

I updated the config dump so it has file groupings as expected by mc-apply.py and then adjusted mc-apply.py to use our standard config.set(file, key, val) and config.add(file, key). I discovered that the ZIP format used for embedding is not compatible with macOS unzip so I switched to a more compatible algorithm. Compression is less efficient, but I also removed the ignore fields in the export, so the ZIP should not be too much larger.

@thinkyhead thinkyhead merged commit 36623a2 into MarlinFirmware:bugfix-2.1.x Jan 8, 2025
64 checks passed
@ellensp ellensp deleted the update-mc-pply branch January 9, 2025 00:43
thinkyhead added a commit that referenced this pull request Mar 11, 2025
EvilGremlin pushed a commit to EvilGremlin/Marlin that referenced this pull request May 15, 2025
EvilGremlin pushed a commit to EvilGremlin/Marlin that referenced this pull request May 15, 2025
@Ferrograph
Copy link

I still cant this to work.

S D:\Working\PROJECTS\Marlin\Code> python buildroot/share/PlatformIO/scripts/mc-apply.py ./Marlin/E3422blt_mfws_config.json DETAILED_BUILD_VERSION: "bugfix-2.1.x-mfs" GIT_REF: 4eb8a87 STRING_DISTRIBUTION_DATE: "2024-12-27" Traceback (most recent call last): File "D:\Working\PROJECTS\Marlin\Code\buildroot\share\PlatformIO\scripts\mc-apply.py", line 100, in <module> main() File "D:\Working\PROJECTS\Marlin\Code\buildroot\share\PlatformIO\scripts\mc-apply.py", line 97, in main apply_config(conf) File "D:\Working\PROJECTS\Marlin\Code\buildroot\share\PlatformIO\scripts\mc-apply.py", line 70, in apply_config back_up_config(key) File "D:\Working\PROJECTS\Marlin\Code\buildroot\share\PlatformIO\scripts\mc-apply.py", line 52, in back_up_config with open(conf_path, 'r', encoding='utf-8') as f: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'Marlin/Z_SAFE_HOMING_X_POINT' PS D:\Working\PROJECTS\Marlin\Code>

Very strange error. Looks like it did actually find and open the file so thats progress, but bombs out at the first KV pair entry.

Unless Im doing something wrong?

@Ferrograph
Copy link

Seems like it goes to make a backup of the header file/s but the filename passed is a key so it looks for a file with the first key name and cant do it.

I dont actually see where it gets the Configuration.h or Configuration_adv.h names from, unless its assuming they are in the buildroot folder? But really it looks like its expecting them to be in the config json. My json extracted from the printer is flat.

Im so confused by how this is supposed to work.

@thisiskeithb
Copy link
Member

I still cant this to work.

STRING_DISTRIBUTION_DATE: "2024-12-27"

@Ferrograph: You're using a version of Marlin from before this PR. Update to the latest bugfix-2.1.x.


This Issue Queue is for Marlin bug reports and development-related issues, and we prefer not to handle user-support questions here. (As noted on this page.) For best results getting help with configuration and troubleshooting, please use the following resources:

@Ferrograph
Copy link

I did update to the latest bugfix-2.1.x code base. Do I need to run "M503 C" on a printer that has the later firmware from Marlin firmware service? I thought only the mc-apply script had been updated?

@thisiskeithb
Copy link
Member

I did update to the latest bugfix-2.1.x code base.

The output you pasted says otherwise.

Do I need to run "M503 C" on a printer that has the later firmware from Marlin firmware service

That is a third-party service and is unrelated to this project. Use Marlin from here (this repo) or download it from marlinfw.org.

Please use the links in my last reply for additional help.

@MarlinFirmware MarlinFirmware locked as resolved and limited conversation to collaborators Jun 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] mc-apply script doesn't function
4 participants