Skip to content

Commit 122b23a

Browse files
committed
Start wheel build from an empty directory
Start build from an empty directory, to avoid accidentally importing python files from the addon root directory during the build process.
1 parent b98616f commit 122b23a

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

Diff for: newsfragments/270.bugfix

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Start wheel build from an empty directory, to avoid accidentally importing
2+
python files from the addon root directory during the build process.

Diff for: src/oca_github_bot/build_wheels.py

+16-12
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,22 @@ def __init__(self):
4545
)
4646

4747
def build_wheel(self, project_dir: Path, dist_dir: str) -> None:
48-
check_call(
49-
[
50-
self.env_python,
51-
"-m",
52-
"build",
53-
"--wheel",
54-
"--outdir",
55-
dist_dir,
56-
"--no-isolation",
57-
],
58-
cwd=project_dir,
59-
)
48+
with tempfile.TemporaryDirectory() as empty_dir:
49+
# Start build from an empty directory, to avoid accidentally importing
50+
# python files from the addon root directory during the build process.
51+
check_call(
52+
[
53+
self.env_python,
54+
"-m",
55+
"build",
56+
"--wheel",
57+
"--outdir",
58+
dist_dir,
59+
"--no-isolation",
60+
project_dir,
61+
],
62+
cwd=empty_dir,
63+
)
6064
self._check_wheels(dist_dir)
6165
return True
6266

0 commit comments

Comments
 (0)