Jelajahi Sumber

[boost] fix test.lua (#5968)

* fix boost test.lua

* Update fetch.lua

---------

Co-authored-by: ruki <[email protected]>
SaeruHikari 7 bulan lalu
induk
melakukan
ec1c0e01d9
2 mengubah file dengan 19 tambahan dan 1 penghapusan
  1. 1 1
      packages/b/boost/fetch.lua
  2. 18 0
      packages/b/boost/test.lua

+ 1 - 1
packages/b/boost/fetch.lua

@@ -10,7 +10,7 @@ function _get_python_libs()
     end
 
     local libs = {}
-    local version = result.version
+    local version = result and result.version
     if version then
         local py_ver = semver.new(version)
         py_ver = py_ver:major() .. py_ver:minor()

+ 18 - 0
packages/b/boost/test.lua

@@ -8,6 +8,9 @@ function _iostreams(package, snippets)
             [[
                 #include <boost/iostreams/filter/zstd.hpp>
                 #include <boost/iostreams/filtering_stream.hpp>
+            #if defined(BOOST_NO_EXCEPTIONS)
+                namespace boost { BOOST_NORETURN inline void throw_exception(std::exception const & e) {} }
+            #endif
                 void test() {
                     boost::iostreams::filtering_ostream out;
                     out.push(boost::iostreams::zstd_compressor());
@@ -21,6 +24,9 @@ function _iostreams(package, snippets)
             [[
                 #include <boost/iostreams/filter/lzma.hpp>
                 #include <boost/iostreams/filtering_stream.hpp>
+            #if defined(BOOST_NO_EXCEPTIONS)
+                namespace boost { BOOST_NORETURN inline void throw_exception(std::exception const & e) {} }
+            #endif
                 void test() {
                     boost::iostreams::filtering_ostream out;
                     out.push(boost::iostreams::lzma_compressor());
@@ -36,6 +42,9 @@ function _filesystem(package, snippets)
             [[
                 #include <boost/filesystem.hpp>
                 #include <iostream>
+            #if defined(BOOST_NO_EXCEPTIONS)
+                namespace boost { BOOST_NORETURN inline void throw_exception(std::exception const & e) {} }
+            #endif
                 void test() {
                     boost::filesystem::path path("/path/to/directory");
                     if (boost::filesystem::exists(path)) {
@@ -54,6 +63,9 @@ function _date_time(package, snippets)
         table.insert(snippets,
             [[
                 #include <boost/date_time/gregorian/gregorian.hpp>
+            #if defined(BOOST_NO_EXCEPTIONS)
+                namespace boost { BOOST_NORETURN inline void throw_exception(std::exception const & e) {} }
+            #endif
                 void test() {
                     boost::gregorian::date d(2010, 1, 30);
                 }
@@ -68,6 +80,9 @@ function _header_only(package, snippets)
             #include <boost/algorithm/string.hpp>
             #include <string>
             #include <vector>
+        #if defined(BOOST_NO_EXCEPTIONS)
+            namespace boost { BOOST_NORETURN inline void throw_exception(std::exception const & e) {} }
+        #endif
             void test() {
                 std::string str("a,b");
                 std::vector<std::string> vec;
@@ -78,6 +93,9 @@ function _header_only(package, snippets)
     table.insert(snippets,
         [[
             #include <boost/unordered_map.hpp>
+        #if defined(BOOST_NO_EXCEPTIONS)
+            namespace boost { BOOST_NORETURN inline void throw_exception(std::exception const & e) {} }
+        #endif
             void test() {
                 boost::unordered_map<std::string, int> map;
                 map["2"] = 2;