OSDN Git Service

Merge branch 'master' of git.sourceforge.jp:/gitroot/meshio/MeshIO
authorousttrue <ousttrue@gmail.com>
Mon, 4 Oct 2010 15:48:01 +0000 (00:48 +0900)
committerousttrue <ousttrue@gmail.com>
Mon, 4 Oct 2010 15:48:01 +0000 (00:48 +0900)
include/text.h
swig/setup.py

index 69a6bff..666c8f9 100644 (file)
@@ -376,11 +376,6 @@ inline void copyStringAndFillZero(char *dst, const std::string &src)
 }
 
 #ifdef _WIN32
-inline std::wstring cp932_to_unicode(const std::string &text)
-{
-    return to_WideChar(cp932_to_utf8, text);
-}
-
 inline std::wstring to_WideChar(UINT uCodePage, const std::string &text)
 {
        int size=MultiByteToWideChar(uCodePage, 0, text.c_str(), -1, NULL, 0);
@@ -397,6 +392,11 @@ inline std::string to_MultiByte(UINT uCodePage, const std::wstring &text)
        return std::string(buf.begin(), buf.begin()+size);
 }
 
+inline std::wstring cp932_to_unicode(const std::string &text)
+{
+    return to_WideChar(CP_OEMCP, text);
+}
+
 inline std::string cp932_to_utf8(const std::string &text)
 {
        return to_MultiByte(CP_UTF8, to_WideChar(CP_OEMCP, text));
index cd4a4c2..ab7646d 100644 (file)
@@ -1,7 +1,5 @@
 # coding: utf-8
 
-import distutils.command.build_ext
-import distutils.command.build_ext
 #from distutils.core import setup, Extension
 from setuptools import setup, Extension
 import os
@@ -88,42 +86,16 @@ else:
                 ]),
             ]
 
-def mysetup(ext_modules, data_files):
-    setup(name="meshio",
-            version=VERSION,
-            description='polygon mesh io utilities',
-            author='ousttrue',
-            author_email='ousttrue@gmail.com',
-            url='http://sourceforge.jp/projects/meshio/',
-            packages=['meshio'],
-            package_dir={'meshio': '.'},
-            ext_package='meshio',
-            ext_modules=ext_modules,
-            data_files=data_files,
-            classifiers = [
-                "Programming Language :: Python",
-                "Programming Language :: Python :: 3",
-                "Development Status :: 4 - Beta",
-                "Environment :: Other Environment",
-                "Intended Audience :: Developers",
-                "License :: OSI Approved :: BSD License",
-                "Operating System :: Microsoft :: Windows",
-                "Operating System :: POSIX :: Linux",
-                "Natural Language :: Japanese",
-                "Topic :: Multimedia :: Graphics :: 3D Modeling",
-                ],
-            )
-
 if os.name=='nt':
-    # スタティックruntime(/MT)とリンクするのでマニフェストが不要だが
-    # mt.exeの呼び出しを止めることができないので
-    # 繰り返す(1度目でエラーになり2度目で通過できる)
-    for i in range(len(ext_modules)+1):
+    import distutils.msvc9compiler
+    org=distutils.msvc9compiler.MSVCCompiler.link
+    def custom(self, *args):
         try:
-            mysetup(ext_modules, data_files)
-            break
-        except:
-            continue
+            org(self, *args)
+        except distutils.msvc9compiler.LinkError as e:
+            print(e)
+    distutils.msvc9compiler.MSVCCompiler.link=custom
+
 else:
     import re
     pattern=re.compile("<:")
@@ -138,9 +110,34 @@ else:
         io.close()
         return new_file
 
+    import distutils.command.build_ext
     org=distutils.command.build_ext.build_ext.swig_sources
     def custom(self, sources, extension):
         return [edit(f) for f in org(self, sources, extension)]
     distutils.command.build_ext.build_ext.swig_sources=custom
-    mysetup(ext_modules, data_files)
+
+setup(name="meshio",
+        version=VERSION,
+        description='polygon mesh io utilities',
+        author='ousttrue',
+        author_email='ousttrue@gmail.com',
+        url='http://sourceforge.jp/projects/meshio/',
+        packages=['meshio'],
+        package_dir={'meshio': '.'},
+        ext_package='meshio',
+        ext_modules=ext_modules,
+        data_files=data_files,
+        classifiers = [
+            "Programming Language :: Python",
+            "Programming Language :: Python :: 3",
+            "Development Status :: 4 - Beta",
+            "Environment :: Other Environment",
+            "Intended Audience :: Developers",
+            "License :: OSI Approved :: BSD License",
+            "Operating System :: Microsoft :: Windows",
+            "Operating System :: POSIX :: Linux",
+            "Natural Language :: Japanese",
+            "Topic :: Multimedia :: Graphics :: 3D Modeling",
+            ],
+        )