Skip to content

Commit fc208d1

Browse files
authored
Keep the file handle for pre-package open (#221)
1 parent c92cc86 commit fc208d1

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

python/rpdk/go/codegen.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,15 @@ def generate(self, project: Project):
239239
@staticmethod
240240
def pre_package(project: Project):
241241
# zip the Go build output - it's all needed to execute correctly
242-
with TemporaryFile("w+b") as f:
243-
with zipfile.ZipFile(f, mode="w") as zip_file:
244-
for path in (project.root / "bin").iterdir():
245-
if path.is_file():
246-
zip_file.write(path.resolve(), path.name)
247-
f.seek(0)
248-
249-
return f
242+
f = TemporaryFile("w+b") # pylint: disable=R1732
243+
244+
with zipfile.ZipFile(f, mode="w") as zip_file:
245+
for path in (project.root / "bin").iterdir():
246+
if path.is_file():
247+
zip_file.write(path.resolve(), path.name)
248+
f.seek(0)
249+
250+
return f
250251

251252
@staticmethod
252253
def _find_exe(project: Project):

0 commit comments

Comments
 (0)