Skip to content

Commit 2a717d6

Browse files
authored
Clean Pip Staging Directory (#2954)
* Clean Pip Staging Directory The distutils staging (`build` -> `_tmppythonbuild`) directory that pip uses to collect build artifacts is not by default cleaned between multiple `pip` runs. This can be confusing when we recompile, because old `libwarpx*` files can be still in it that are not present in our own `build/lib/`. This cleans that staging directory before builds now. It also sets the whole `build_base` so that no artifact lands in the default, which was `build/`. So far, `bdist.linux-x86_64/` still was out-of-tree. * Python_background_mcc_1d: Add CMake Options Add missing CMake options in `WarpX-tests.ini`. This must have been merged in parallel to when we modernized our regression tests end of last year. #2556
1 parent 96cefab commit 2a717d6

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Regression/WarpX-tests.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2946,7 +2946,7 @@ runtime_params =
29462946
customRunCmd = python3 PICMI_inputs_2d.py
29472947
dim = 2
29482948
addToCompileString = USE_PYTHON_MAIN=TRUE
2949-
cmakeSetupOpts = -DWarpX_DIMS=2 -DWarpX_LIB=ON -DWarpX_APP=ON
2949+
cmakeSetupOpts = -DWarpX_DIMS=2 -DWarpX_LIB=ON -DWarpX_APP=OFF
29502950
target = pip_install
29512951
restartTest = 0
29522952
useMPI = 1
@@ -2965,6 +2965,8 @@ runtime_params =
29652965
customRunCmd = python3 PICMI_inputs_1d.py --test
29662966
dim = 1
29672967
addToCompileString = USE_PYTHON_MAIN=TRUE
2968+
cmakeSetupOpts = -DWarpX_DIMS=1 -DWarpX_LIB=ON -DWarpX_APP=OFF
2969+
target = pip_install
29682970
restartTest = 0
29692971
useMPI = 1
29702972
numprocs = 2

setup.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from distutils.command.build import build
2+
from distutils.command.clean import clean
23
from distutils.version import LooseVersion
34
import os
45
import platform
@@ -14,13 +15,23 @@
1415
class CopyPreBuild(build):
1516
def initialize_options(self):
1617
build.initialize_options(self)
17-
# We just overwrite this because the default "build/lib" clashes with
18-
# directories many developers have in their source trees;
18+
# We just overwrite this because the default "build" (and "build/lib")
19+
# clashes with directories many developers have in their source trees;
1920
# this can create confusing results with "pip install .", which clones
2021
# the whole source tree by default
21-
self.build_lib = '_tmppythonbuild'
22+
self.build_base = '_tmppythonbuild'
2223

2324
def run(self):
25+
# remove existing build directory
26+
# by default, this stays around. we want to make sure generated
27+
# files like libwarpx.(2d|3d|rz).(so|pyd) are always only the
28+
# ones we want to package and not ones from an earlier wheel's stage
29+
c = clean(self.distribution)
30+
c.all = True
31+
c.finalize_options()
32+
c.run()
33+
34+
# call superclass
2435
build.run(self)
2536

2637
# matches: libwarpx.(2d|3d|rz).(so|pyd)

0 commit comments

Comments
 (0)