OSDN Git Service

vc2008, gcc-4.5
authorousttrue <ousttrue@gmail.com>
Tue, 3 May 2011 17:25:29 +0000 (02:25 +0900)
committerousttrue <ousttrue@gmail.com>
Tue, 3 May 2011 17:25:29 +0000 (02:25 +0900)
src/text.h
swig/python/setup.py

index b192b64..34b6f96 100644 (file)
@@ -10,7 +10,7 @@
 #include <stdlib.h>
 #include <cstring>
 
-#if defined(_WIN32)
+#ifdef _MSC_VER
 #include <windows.h>
 #else
 #include <iconv.h>
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',