OSDN Git Service

vc2008, gcc-4.5
[meshio/meshio.git] / swig / python / setup.py
index fa483f4..feeae64 100644 (file)
@@ -1,5 +1,5 @@
 import os
-import commands
+import shutil
 from distutils.core import setup, Extension
 
 def exec_command(cmd):
@@ -12,16 +12,26 @@ if os.name=='nt':
     extra_compile_args=["/EHsc", "/wd4996"]
     libraries=[]
     include_dirs=['../../src', BOOST_ROOT]
+    if os.path.exists("meshio/mqo.py"):
+        os.remove("meshio/mqo.py")
+    if os.path.exists("meshio/pmd.py"):
+        os.remove("meshio/pmd.py")
     exec_command("swig -c++ -python -o mqo_wrap.cpp -D_MSC_VER ../mqo.i")
     exec_command("swig -c++ -python -o pmd_wrap.cpp -D_MSC_VER ../pmd.i")
-    exec_command("mv mqo.py pmd.py meshio")
+    shutil.move("mqo.py", "meshio")
+    shutil.move("pmd.py", "meshio")
 else:
     extra_compile_args=['-std=c++0x']
     libraries=["iconv"]
     include_dirs=['../../src']
+    if os.path.exists("meshio/mqo.py"):
+        os.remove("meshio/mqo.py")
+    if os.path.exists("meshio/pmd.py"):
+        os.remove("meshio/pmd.py")
     exec_command("swig -c++ -python -o mqo_wrap.cpp ../mqo.i")
     exec_command("swig -c++ -python -o pmd_wrap.cpp ../pmd.i")
-    exec_command("mv mqo.py pmd.py meshio")
+    shutil.move("mqo.py", "meshio")
+    shutil.move("pmd.py", "meshio")
 
 setup(
         name='meshio',