Skip to content

Commit

Permalink
Start wheel build from an empty directory
Browse files Browse the repository at this point in the history
Start build from an empty directory, to avoid accidentally importing
python files from the addon root directory during the build process.
  • Loading branch information
sbidoul committed Nov 14, 2023
1 parent b98616f commit 122b23a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 2 additions & 0 deletions newsfragments/270.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Start wheel build from an empty directory, to avoid accidentally importing
python files from the addon root directory during the build process.
28 changes: 16 additions & 12 deletions src/oca_github_bot/build_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,22 @@ def __init__(self):
)

def build_wheel(self, project_dir: Path, dist_dir: str) -> None:
check_call(
[
self.env_python,
"-m",
"build",
"--wheel",
"--outdir",
dist_dir,
"--no-isolation",
],
cwd=project_dir,
)
with tempfile.TemporaryDirectory() as empty_dir:
# Start build from an empty directory, to avoid accidentally importing
# python files from the addon root directory during the build process.
check_call(
[
self.env_python,
"-m",
"build",
"--wheel",
"--outdir",
dist_dir,
"--no-isolation",
project_dir,
],
cwd=empty_dir,
)
self._check_wheels(dist_dir)
return True

Expand Down

0 comments on commit 122b23a

Please sign in to comment.