Skip to content

Commit

Permalink
Add ZIP file compression
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouni committed Jun 20, 2023
1 parent 6af6a6a commit 2ddeed1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fabrication.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import re
from pathlib import Path
from zipfile import ZipFile
from zipfile import ZipFile, ZIP_DEFLATED

from pcbnew import (
EXCELLON_WRITER,
Expand Down Expand Up @@ -250,7 +250,12 @@ def generate_excellon(self):
def zip_gerber_excellon(self):
"""Zip Gerber and Excellon files, ready for upload to JLCPCB."""
zipname = f"GERBER-{self.filename.split('.')[0]}.zip"
with ZipFile(os.path.join(self.outputdir, zipname), "w") as zipfile:
with ZipFile(
os.path.join(self.outputdir, zipname),
"w",
compression=ZIP_DEFLATED,
compresslevel=9,
) as zipfile:
for folderName, subfolders, filenames in os.walk(self.gerberdir):
for filename in filenames:
if not filename.endswith(("gbr", "drl", "pdf")):
Expand Down

0 comments on commit 2ddeed1

Please sign in to comment.