Browse Source

Allow compresslevel to bet set on cmd

Create a debug curapackage with a compresslevel=0
for quick debugging packages.

```bash
python build/generators/package.py --build --compresslevel=0
```

Contributes to CURA-9068
CURA-9068_update_NativeCADimport_plugin_to_use_sip_6
j.spijker@ultimaker.com 4 years ago committed by Jelle Spijker
parent
commit
b0daa772e8
  1. 7
      generators/CuraPackage.py

7
generators/CuraPackage.py

@ -97,11 +97,11 @@ def configure(source_dir, build_dir):
shutil.copy(src, dst)
def build(build_dir):
def build(build_dir, compresslevel):
src_dir = Path(build_dir, "curapackage")
dst_file = Path(build_dir, "{{ package_id }}.curapackage")
with zipfile.ZipFile(dst_file, "w", compression = zipfile.ZIP_LZMA) as curapackage:
with zipfile.ZipFile(dst_file, "w", compression = zipfile.ZIP_DEFLATED, compresslevel = compresslevel) as curapackage:
for root, dirs, files in os.walk(os.path.normpath(src_dir)):
root_path = Path(root)
rel_path = root_path.relative_to(src_dir)
@ -121,6 +121,7 @@ def main():
parser.add_argument("--configure", action = "store_true")
parser.add_argument("--build", action = "store_true")
parser.add_argument("--deploy", action = "store_true")
parser.add_argument("--compresslevel", type = int, default = 9)
parser.add_argument("-S", type = str, default = r"{{ source_directory }}", help = "Source Path")
parser.add_argument("-B", type = str, default = r"{{ build_directory }}", help = "Build path")
parser.add_argument("-D", type = str, default = r"{{ build_directory }}", help = "Deploy path")
@ -134,7 +135,7 @@ def main():
configure(args.S, args.B)
if args.build:
build(args.B)
build(args.B, args.compresslevel)
if args.deploy:
deploy(args.D)

Loading…
Cancel
Save