Skip to content

Commit 608d1ea

Browse files
authored
fix(package builder): error with compressing the package in right structure (#29)
1 parent 7cbced6 commit 608d1ea

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "socha"
7-
version = "1.0.6"
7+
version = "1.0.7"
88
authors = [
99
{ name = "FalconsSky", email = "stu222782@mail.uni-kiel.de" },
1010
]

socha/utils/package_builder.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,13 @@ def _zipdir(self):
160160
zipf = zipfile.ZipFile(f'{self.build_dir}/{self.package_name}.zip', 'w', zipfile.ZIP_DEFLATED)
161161
for root, dirs, files in os.walk(f'{self.build_dir}/{self.package_name}'):
162162
for file in files:
163-
zipf.write(os.path.join(root, file))
163+
file_path = os.path.join(root, file)
164+
arc_name = os.path.relpath(file_path, self.build_dir)
165+
zipf.write(file_path, arcname=arc_name)
164166
for _dir in dirs:
165-
zipf.write(os.path.join(root, _dir))
167+
dir_path = os.path.join(root, _dir)
168+
arc_name = os.path.relpath(dir_path, self.build_dir)
169+
zipf.write(dir_path, arcname=arc_name)
166170
zipf.close()
167171
logging.info(f'{self.package_name}.zip successfully created!')
168172
except Exception as e:

0 commit comments

Comments
 (0)