Skip to content
This repository has been archived by the owner on Jul 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #71 from keisukefukuda/fix-rm-command-mpi4py-51
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
keisukefukuda committed Jul 21, 2017
2 parents c9947e0 + cc2a3d0 commit 4de5c61
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions mpienv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from mpienv.mpi import BrokenMPI
from mpienv.mpi import MPI
from mpienv.py import MPI4Py

try:
import __builtin__
Expand Down Expand Up @@ -235,6 +236,10 @@ def rm(self, name, prompt=False):
if (not prompt) or yes_no_input("Remove '{}' ?".format(name)):
mpi.remove()

mpi4py = MPI4Py(self._conf, name)
if mpi4py.is_installed():
mpi4py.rm()

def rename(self, name_from, name_to):
if name_from not in self:
raise RuntimeError("No such MPI: '{}'".format(name_from))
Expand Down
9 changes: 8 additions & 1 deletion mpienv/py.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import glob
import os
import os.path
import shutil
from subprocess import check_call
import sys

Expand Down Expand Up @@ -53,7 +54,9 @@ def install(self):
with open(os.devnull, 'w') as devnull:
check_call(['pip', 'install', '-t', self._pylib_dir,
'--no-cache-dir', self._libname],
stdout=devnull, env=env)
stdout=sys.stderr,
env=env)
devnull # NOQA

def use(self):
pypath = os.environ.get('PYTHONPATH', None)
Expand All @@ -71,6 +74,10 @@ def use(self):
def pylib_dir(self):
return self._pylib_dir

def rm(self):
if os.path.exists(self._pylib_dir):
shutil.rmtree(self._pylib_dir)


class MPI4Py(PyModule):
def __init__(self, conf, name):
Expand Down

0 comments on commit 4de5c61

Please sign in to comment.