diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 5a30cd5aa5..14961209c8 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -841,8 +841,7 @@ if(BUILD_SHARED_LIBS) set(LIBLAMMPS_SHARED_BINARY ${MY_BUILD_DIR}/liblammps${LAMMPS_MACHINE}${CMAKE_SHARED_LIBRARY_SUFFIX}) if(Python_EXECUTABLE) add_custom_target( - install-python ${CMAKE_COMMAND} -E remove_directory build - COMMAND ${Python_EXECUTABLE} ${LAMMPS_PYTHON_DIR}/install.py -p ${LAMMPS_PYTHON_DIR}/lammps + install-python ${Python_EXECUTABLE} ${LAMMPS_PYTHON_DIR}/install.py -p ${LAMMPS_PYTHON_DIR}/lammps -l ${LIBLAMMPS_SHARED_BINARY} -w ${MY_BUILD_DIR} COMMENT "Installing LAMMPS Python module") else() diff --git a/python/install.py b/python/install.py index 591e8525dc..561e93caa9 100644 --- a/python/install.py +++ b/python/install.py @@ -59,6 +59,10 @@ olddir = os.path.abspath('.') os.chdir(os.path.dirname(args.package)) # remove any wheel files left over from previous calls +if os.path.isdir(os.path.join(olddir,"build")): + print("Cleaning old build directory") + shutil.rmtree(os.path.join(olddir,"build")) + print("Purging existing wheels...") for wheel in glob.glob('lammps-*.whl'): print("deleting " + wheel)