Browse Source

Intermediate changes
commit_hash:76d9aa57ae49c693d057903a6fff77fc0019843b

robot-piglet 3 months ago
parent
commit
41946a9a12

+ 14 - 12
contrib/python/cppy/.dist-info/METADATA

@@ -1,22 +1,25 @@
 Metadata-Version: 2.1
 Name: cppy
-Version: 1.2.1
-Summary: UNKNOWN
-Home-page: https://github.com/nucleic/cppy
+Version: 1.3.0
 Author-email: The Nucleic Development Team <sccolbert@gmail.com>
 Maintainer-email: "Matthieu C. Dartiailh" <m.dartiailh@gmail.com>
 License: Copyright (c) 2014, Nucleic
-        All rights reserved.        
+        All rights reserved.
+        
         Redistribution and use in source and binary forms, with or without
-        modification, are permitted provided that the following conditions are met:        
+        modification, are permitted provided that the following conditions are met:
+        
         * Redistributions of source code must retain the above copyright notice, this
-          list of conditions and the following disclaimer.        
+          list of conditions and the following disclaimer.
+        
         * Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
-          and/or other materials provided with the distribution.        
+          and/or other materials provided with the distribution.
+        
         * Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
-          this software without specific prior written permission.        
+          this software without specific prior written permission.
+        
         THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
         AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
         IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -26,12 +29,12 @@ License: Copyright (c) 2014, Nucleic
         SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
         CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
         OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.        
+        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+        
 Project-URL: homepage, https://github.com/nucleic/cppy
 Project-URL: documentation, https://cppy.readthedocs.io/en/latest/
 Project-URL: repository, https://github.com/nucleic/cppy
 Project-URL: changelog, https://github.com/nucleic/cppy/blob/main/releasenotes.rst
-Platform: UNKNOWN
 Classifier: License :: OSI Approved :: BSD License
 Classifier: Programming Language :: Python
 Classifier: Programming Language :: Python :: 3
@@ -43,6 +46,7 @@ Classifier: Programming Language :: Python :: Implementation :: CPython
 Requires-Python: >=3.7
 Description-Content-Type: text/x-rst
 License-File: LICENSE
+Requires-Dist: setuptools>=61.2
 
 Cppy
 ====
@@ -54,5 +58,3 @@ A small C++ header library which makes it easier to write Python extension
 modules. The primary feature is a PyObject smart pointer which automatically
 handles reference counting and provides convenience methods for performing
 common object operations.
-
-

+ 25 - 11
contrib/python/cppy/cppy/__init__.py

@@ -15,7 +15,8 @@ from .version import __version__, __version_info__
 
 def get_include():
     import os
-    return os.path.join(os.path.dirname(__file__), 'include')
+
+    return os.path.join(os.path.dirname(__file__), "include")
 
 
 class CppyBuildExt(build_ext):
@@ -30,7 +31,6 @@ class CppyBuildExt(build_ext):
     c_opts = {"msvc": ["/EHsc"], "unix": ["-std=c++11"]}
 
     def build_extensions(self):
-
         ct = self.compiler.compiler_type
         opts = self.c_opts.get(ct, [])
         cppy_includes = get_include()
@@ -43,16 +43,30 @@ class CppyBuildExt(build_ext):
                 # we can sure it will be present.
                 compiler_cmd = self.compiler.compiler_so
                 # Check if we are using Clang, accounting for absolute path
-                if compiler_cmd is not None and 'clang' in compiler_cmd[0]:
+                if compiler_cmd is not None and "clang" in compiler_cmd[0]:
                     # If so ensure we use a recent enough version of the stdlib
-                    ext.extra_compile_args += ["-stdlib=libc++"]
-                    ext.extra_link_args += ["-stdlib=libc++"]
-            if ct == "msvc" and os.environ.get("CPPY_DISABLE_FH4"):
-                # Disable FH4 Exception Handling implementation so that we don't
-                # require VCRUNTIME140_1.dll. For more details, see:
-                # https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/
-                # https://github.com/joerick/cibuildwheel/issues/423#issuecomment-677763904
-                ext.extra_compile_args.append("/d2FH4-")
+                    ext.extra_compile_args.append("-stdlib=libc++")
+                    ext.extra_link_args.append("-stdlib=libc++")
+            if ct == "msvc":
+                # Switch to a static build for runtimes, but use dynamic
+                # linking for `VCRUNTIME140.dll`, `VCRUNTIME140_1.dll`, and the UCRT.
+                # This avoids requiring specific versions of `MSVCP140.dll`, while
+                # keeping shared state with the rest of the Python process/extensions.
+                ext.extra_compile_args.append("/MT")
+                ext.extra_link_args.extend(
+                    [
+                        "ucrt.lib",
+                        "vcruntime.lib",
+                        "/nodefaultlib:libucrt.lib",
+                        "/nodefaultlib:libvcruntime.lib",
+                    ]
+                )
+                if os.environ.get("CPPY_DISABLE_FH4"):
+                    # Disable FH4 Exception Handling implementation so that we don't
+                    # require VCRUNTIME140_1.dll. For more details, see:
+                    # https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/
+                    # https://github.com/joerick/cibuildwheel/issues/423#issuecomment-677763904
+                    ext.extra_compile_args.append("/d2FH4-")
         build_ext.build_extensions(self)
 
 

+ 2 - 2
contrib/python/cppy/cppy/version.py

@@ -12,7 +12,7 @@ from collections import namedtuple
 #: A namedtuple of the version info for the current release.
 _version_info = namedtuple("_version_info", "major minor micro status")
 
-parts = "1.2.1".split(".", 3)
+parts = "1.3.0".split(".", 3)
 __version_info__ = _version_info(
     int(parts[0]),
     int(parts[1]),
@@ -23,4 +23,4 @@ __version_info__ = _version_info(
 # Remove everything but the 'version_info' from this module.
 del namedtuple, _version_info, parts
 
-__version__ = "1.2.1"
+__version__ = "1.3.0"

+ 1 - 1
contrib/python/cppy/ya.make

@@ -2,7 +2,7 @@
 
 PY3_LIBRARY()
 
-VERSION(1.2.1)
+VERSION(1.3.0)
 
 LICENSE(BSD-3-Clause)