@@ -39,9 +39,9 @@ def get_file_sha256sum(filepath):
39
39
# Compress a JSON file into a zip file
40
40
#
41
41
import zipfile
42
- def compress_file (filepath , outpath ):
42
+ def compress_file (filepath , storedname , outpath ):
43
43
with zipfile .ZipFile (outpath , 'w' , compression = zipfile .ZIP_BZIP2 , compresslevel = 9 ) as zipf :
44
- zipf .write (filepath , compress_type = zipfile .ZIP_BZIP2 , compresslevel = 9 )
44
+ zipf .write (filepath , arcname = storedname , compress_type = zipfile .ZIP_BZIP2 , compresslevel = 9 )
45
45
46
46
#
47
47
# Compute the build signature. The idea is to extract all defines in the configuration headers
@@ -56,14 +56,13 @@ def compute_build_signature(env):
56
56
files_to_keep = [ 'Marlin/Configuration.h' , 'Marlin/Configuration_adv.h' ]
57
57
58
58
build_path = Path (env ['PROJECT_BUILD_DIR' ], env ['PIOENV' ])
59
- build_path_relative = Path ('.pio' , 'build' , env ['PIOENV' ])
60
59
61
60
# Check if we can skip processing
62
61
hashes = ''
63
62
for header in files_to_keep :
64
63
hashes += get_file_sha256sum (header )[0 :10 ]
65
64
66
- marlin_json = build_path_relative / 'marlin_config.json'
65
+ marlin_json = build_path / 'marlin_config.json'
67
66
marlin_zip = build_path / 'mc.zip'
68
67
69
68
# Read existing config file
@@ -72,7 +71,7 @@ def compute_build_signature(env):
72
71
conf = json .load (infile )
73
72
if conf ['__INITIAL_HASH' ] == hashes :
74
73
# Same configuration, skip recomputing the building signature
75
- compress_file (marlin_json , marlin_zip )
74
+ compress_file (marlin_json , 'marlin_config.json' , marlin_zip )
76
75
return
77
76
except :
78
77
pass
@@ -256,7 +255,7 @@ def tryint(key):
256
255
return
257
256
258
257
# Compress the JSON file as much as we can
259
- compress_file (marlin_json , marlin_zip )
258
+ compress_file (marlin_json , 'marlin_config.json' , marlin_zip )
260
259
261
260
# Generate a C source file for storing this array
262
261
with open ('Marlin/src/mczip.h' ,'wb' ) as result_file :
0 commit comments