summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-08-31 20:00:36 +0300
committerrobot-piglet <[email protected]>2025-08-31 20:11:04 +0300
commit19c9ebfca4556e766aa7121e3893cb235022256e (patch)
treebc59bc6869ac28224700228e66849ef48f69626b
parent2ab5cfb1d5db344f7ac3c66671594f3b0a590ab3 (diff)
Intermediate changes
commit_hash:d8a5d171761d004556c21491e0dbec959e6818a5
-rw-r--r--contrib/libs/googleapis-common-protos/.yandex_meta/__init__.py32
-rw-r--r--contrib/libs/googleapis-common-protos/.yandex_meta/default.nix13
-rw-r--r--contrib/libs/jinja2cpp/.yandex_meta/__init__.py72
-rw-r--r--contrib/libs/jinja2cpp/.yandex_meta/boost-external.patch15
-rw-r--r--contrib/libs/jinja2cpp/.yandex_meta/default.nix100
-rw-r--r--contrib/libs/jinja2cpp/.yandex_meta/externals.patch13
-rw-r--r--contrib/libs/jinja2cpp/patches/01-ambigious-format_to.sh2
-rw-r--r--contrib/libs/jinja2cpp/patches/02-incomplete-types.patch57
-rw-r--r--contrib/libs/jinja2cpp/patches/iterators.patch11
-rw-r--r--contrib/libs/jinja2cpp/patches/pr-259-fix_qadric_tojson.patch43
-rw-r--r--contrib/libs/miniselect/.yandex_meta/__init__.py17
-rw-r--r--contrib/libs/miniselect/.yandex_meta/default.nix14
-rw-r--r--contrib/libs/pdqsort/.yandex_meta/__init__.py14
-rw-r--r--contrib/libs/pdqsort/.yandex_meta/default.nix13
-rw-r--r--contrib/libs/t1ha/.yandex_meta/__init__.py19
-rw-r--r--contrib/libs/t1ha/.yandex_meta/default.nix15
-rw-r--r--contrib/libs/t1ha/patches/clang-cl.patch5
-rw-r--r--contrib/libs/t1ha/patches/sanitizer.patch17
-rw-r--r--contrib/python/marisa-trie/py3/.dist-info/METADATA65
-rw-r--r--contrib/python/marisa-trie/py3/.yandex_meta/yamaker.yaml2
-rw-r--r--contrib/python/marisa-trie/py3/AUTHORS1
-rw-r--r--contrib/python/marisa-trie/py3/COPYING.md34
-rw-r--r--contrib/python/marisa-trie/py3/LICENSE2
-rw-r--r--contrib/python/marisa-trie/py3/README.rst28
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/AUTHORS1
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/COPYING.md34
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/include/marisa/agent.h14
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/include/marisa/base.h16
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/include/marisa/exception.h3
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/include/marisa/key.h14
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/include/marisa/keyset.h9
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/include/marisa/query.h14
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-array.h5
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-ptr.h5
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/algorithm/sort.h2
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/io/mapper.cc23
-rw-r--r--contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/vector/bit-vector.cc166
-rw-r--r--contrib/python/marisa-trie/py3/ya.make8
-rw-r--r--contrib/restricted/expected-lite/.yandex_meta/__init__.py19
-rw-r--r--contrib/restricted/expected-lite/.yandex_meta/default.nix15
40 files changed, 813 insertions, 139 deletions
diff --git a/contrib/libs/googleapis-common-protos/.yandex_meta/__init__.py b/contrib/libs/googleapis-common-protos/.yandex_meta/__init__.py
new file mode 100644
index 00000000000..036f735a649
--- /dev/null
+++ b/contrib/libs/googleapis-common-protos/.yandex_meta/__init__.py
@@ -0,0 +1,32 @@
+import os
+
+from devtools.yamaker.arcpath import ArcPath
+from devtools.yamaker.project import NixSourceProject
+
+
+def post_install(self):
+ protos = []
+ for root, _, files in os.walk(self.dstdir):
+ rel_root = os.path.relpath(root, self.dstdir)
+ protos += [f"{rel_root}/{file}" for file in files if file.endswith("proto")]
+
+ self.yamakes["."] = self.module(
+ module="PROTO_LIBRARY",
+ SRCS=protos,
+ GRPC=True,
+ PROTO_NAMESPACE=ArcPath(self.arcdir, GLOBAL=True),
+ PY_NAMESPACE=".",
+ )
+ self.yamakes["."].before("END", "EXCLUDE_TAGS(GO_PROTO)\n")
+ self.yamakes["."].before("END", "INCLUDE_TAGS(DOCS_PROTO)\n")
+
+
+googleapis_common_protos = NixSourceProject(
+ arcdir="contrib/libs/googleapis-common-protos",
+ nixattr="googleapis-common-protos",
+ copy_sources=[
+ "google/**/*.proto",
+ ],
+ owners=["g:cpp-contrib"],
+ post_install=post_install,
+)
diff --git a/contrib/libs/googleapis-common-protos/.yandex_meta/default.nix b/contrib/libs/googleapis-common-protos/.yandex_meta/default.nix
new file mode 100644
index 00000000000..91303c23b12
--- /dev/null
+++ b/contrib/libs/googleapis-common-protos/.yandex_meta/default.nix
@@ -0,0 +1,13 @@
+self: super: with self; {
+ googleapis-common-protos = stdenv.mkDerivation rec {
+ name = "googleapis-common-protos";
+ version = "1.66.0";
+
+ src = fetchFromGitHub {
+ owner = "googleapis";
+ repo = "python-api-common-protos";
+ rev = "v${version}";
+ hash = "sha256-OQkWSgxNJClbldwTOUU2evySTaRUN5ox5Lw+KytbZ7k=";
+ };
+ };
+}
diff --git a/contrib/libs/jinja2cpp/.yandex_meta/__init__.py b/contrib/libs/jinja2cpp/.yandex_meta/__init__.py
new file mode 100644
index 00000000000..676cf51bfb2
--- /dev/null
+++ b/contrib/libs/jinja2cpp/.yandex_meta/__init__.py
@@ -0,0 +1,72 @@
+import os
+
+from devtools.yamaker import boost
+from devtools.yamaker import fileutil
+from devtools.yamaker import pathutil
+from devtools.yamaker.project import CMakeNinjaNixProject
+
+
+HEADERS_FROM_STD = ["optional", "string_view", "variant"]
+TOKENS_FROM_STD = [
+ "basic_string_view",
+ "get",
+ "get_if",
+ "optional",
+ "string_view",
+ "variant",
+ "visit",
+ "wstring_view",
+]
+
+
+def post_install(self):
+ with self.yamakes["."] as jinja2cpp:
+ # Emulate -DJINJA2CPP_WITH_JSON_BINDINGS=rapid which is broken in upstream
+ os.remove(f"{self.dstdir}/src/binding/boost_json_serializer.h")
+ os.remove(f"{self.dstdir}/src/binding/boost_json_serializer.cpp")
+ jinja2cpp.SRCS.remove("src/binding/boost_json_serializer.cpp")
+
+ jinja2cpp.PEERDIR += [
+ boost.make_arcdir("algorithm"),
+ boost.make_arcdir("container"),
+ boost.make_arcdir("numeric_conversion"),
+ boost.make_arcdir("unordered"),
+ boost.make_arcdir("variant"),
+ ]
+
+ # use optional, string_view and variant from std without relying onto nonstd proxies
+ for header in HEADERS_FROM_STD:
+ fileutil.re_sub_dir(
+ self.dstdir,
+ f"<nonstd/{header}.hpp>",
+ f"<{header}>",
+ test=pathutil.is_preprocessable,
+ )
+
+ for token in TOKENS_FROM_STD:
+ fileutil.re_sub_dir(
+ self.dstdir,
+ rf"nonstd::{token}\b",
+ f"std::{token}",
+ test=pathutil.is_preprocessable,
+ )
+
+ # use absolute includes for nonstd/expected.hpp
+ fileutil.re_sub_dir(
+ self.dstdir,
+ "<nonstd/expected.hpp>",
+ "<contrib/restricted/expected-lite/include/nonstd/expected.hpp>",
+ test=pathutil.is_preprocessable,
+ )
+
+
+jinja2cpp = CMakeNinjaNixProject(
+ owners=["g:cpp-contrib"],
+ arcdir="contrib/libs/jinja2cpp",
+ nixattr="jinja2cpp",
+ disable_includes=[
+ "binding/boost_json_serializer.h",
+ ],
+ post_install=post_install,
+ addincl_global={".": {"contrib/libs/rapidjson/include"}},
+)
diff --git a/contrib/libs/jinja2cpp/.yandex_meta/boost-external.patch b/contrib/libs/jinja2cpp/.yandex_meta/boost-external.patch
new file mode 100644
index 00000000000..bb5df705ff9
--- /dev/null
+++ b/contrib/libs/jinja2cpp/.yandex_meta/boost-external.patch
@@ -0,0 +1,15 @@
+diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt
+index fc8f51d..49c55b2 100644
+--- a/thirdparty/CMakeLists.txt
++++ b/thirdparty/CMakeLists.txt
+@@ -70,8 +70,8 @@ endif()
+
+ if (NOT DEFINED JINJA2_PRIVATE_LIBS_INT)
+ set(JINJA2CPP_PRIVATE_LIBS ${JINJA2CPP_PRIVATE_LIBS}
+- Boost::variant Boost::filesystem Boost::algorithm Boost::lexical_cast Boost::json
+- Boost::regex fmt RapidJson)
++ boost_variant boost_filesystem boost_algorithm boost_json
++ boost_regex fmt RapidJson)
+ else ()
+ set (JINJA2CPP_PRIVATE_LIBS ${JINJA2_PRIVATE_LIBS_INT})
+ endif ()
diff --git a/contrib/libs/jinja2cpp/.yandex_meta/default.nix b/contrib/libs/jinja2cpp/.yandex_meta/default.nix
new file mode 100644
index 00000000000..f44f673c6f0
--- /dev/null
+++ b/contrib/libs/jinja2cpp/.yandex_meta/default.nix
@@ -0,0 +1,100 @@
+self: super: with self; let
+
+ optional-lite = stdenv.mkDerivation rec {
+ name = "optional-lite";
+ version = "3.6.0";
+
+ src = fetchFromGitHub {
+ owner = "martinmoene";
+ repo = "optional-lite";
+ rev = "v${version}";
+ sha256 = "sha256-qmKuxYc0cpoOtRRb4okJZ8pYPvzQid1iqBctnhGlz6M=";
+ };
+
+ nativeBuildInputs = [ cmake ];
+
+ cmakeFlags = [
+ "-DOPTIONAL_LITE_OPT_BUILD_TESTS=OFF"
+ ];
+ };
+
+ variant-lite = stdenv.mkDerivation rec {
+ pname = "variant-lite";
+ version = "2.0.0";
+
+ src = fetchFromGitHub {
+ owner = "martinmoene";
+ repo = "variant-lite";
+ rev = "v${version}";
+ hash = "sha256-zLyzNzeD0C4e7CYqCCsPzkqa2cH5pSbL9vNVIxdkEfc=";
+ };
+
+ nativeBuildInputs = [ cmake ];
+
+ cmakeFlags = [
+ "-DVARIANT_LITE_OPT_BUILD_TESTS=OFF"
+ ];
+ };
+
+ string-view-lite = stdenv.mkDerivation rec {
+ pname = "string-view-lite";
+ version = "1.7.0";
+
+ src = fetchFromGitHub {
+ owner = "martinmoene";
+ repo = "string-view-lite";
+ rev = "v${version}";
+ hash = "sha256-L7b0MGp9grE/a9ppzsPe6UzEoA/yK3y1VD24OB7oadw=";
+ };
+
+ nativeBuildInputs = [ cmake ];
+
+ cmakeFlags = [
+ "-DSTRING_VIEW_LITE_OPT_BUILD_TESTS=OFF"
+ ];
+ };
+
+in {
+ jinja2cpp = stdenv.mkDerivation rec {
+ pname = "jinja2cpp";
+ version = "1.3.1";
+
+ src = fetchFromGitHub {
+ owner = "jinja2cpp";
+ repo = "Jinja2Cpp";
+ rev = "${version}";
+ hash = "sha256-pWNHugUab0ACuhOivw4LZFcHhwxDSMsVz8hDiw/XVW8=";
+ };
+
+ patches = [ ./externals.patch ./boost-external.patch ];
+
+ nativeBuildInputs = [ cmake ];
+
+ cmakeFlags = [
+ "-DJINJA2CPP_DEPS_MODE=external"
+ "-DJINJA2CPP_CXX_STANDARD=17"
+ "-DJINJA2CPP_BUILD_TESTS=FALSE"
+
+ # FIXME: this setting has no effect,
+ # as CMakeLists.txt in upstream unconditionally overwrites it.
+ # We will emulate necessary behavior during post_install()
+ "-DJINJA2CPP_WITH_JSON_BINDINGS=none"
+ ];
+
+ CXXFLAGS = [
+ "-DFMT_USE_INTERNAL=TRUE"
+ ];
+
+ buildInputs = [
+ boost
+ gtest
+ fmt_9
+ rapidjson
+
+ expected-lite
+ optional-lite
+ string-view-lite
+ variant-lite
+ ];
+ };
+}
diff --git a/contrib/libs/jinja2cpp/.yandex_meta/externals.patch b/contrib/libs/jinja2cpp/.yandex_meta/externals.patch
new file mode 100644
index 00000000000..a968f684325
--- /dev/null
+++ b/contrib/libs/jinja2cpp/.yandex_meta/externals.patch
@@ -0,0 +1,13 @@
+diff --git a/thirdparty/thirdparty-external.cmake b/thirdparty/thirdparty-external.cmake
+index 524dabe..b2bb08b 100644
+--- a/thirdparty/thirdparty-external.cmake
++++ b/thirdparty/thirdparty-external.cmake
+@@ -27,7 +27,7 @@ macro (find_hdr_package PKG_NAME HDR_PATH)
+
+ if(${PKG_NAME}_FOUND)
+ if (NOT TARGET ${PKG_NAME})
+- imported_target_alias(${PKG_NAME} ALIAS "${PKG_NAME}::${PKG_NAME}")
++ imported_target_alias(${PKG_NAME} ALIAS "nonstd::${PKG_NAME}")
+ endif ()
+ else()
+ message(FATAL_ERROR "${PKG_NAME} not found!")
diff --git a/contrib/libs/jinja2cpp/patches/01-ambigious-format_to.sh b/contrib/libs/jinja2cpp/patches/01-ambigious-format_to.sh
new file mode 100644
index 00000000000..8015407b2de
--- /dev/null
+++ b/contrib/libs/jinja2cpp/patches/01-ambigious-format_to.sh
@@ -0,0 +1,2 @@
+sed -i 's|fmt::format_to|format_to|g' src/error_info.cpp
+sed -i 's|format_to|fmt::format_to|g' src/error_info.cpp
diff --git a/contrib/libs/jinja2cpp/patches/02-incomplete-types.patch b/contrib/libs/jinja2cpp/patches/02-incomplete-types.patch
new file mode 100644
index 00000000000..c4a7fd4a0f7
--- /dev/null
+++ b/contrib/libs/jinja2cpp/patches/02-incomplete-types.patch
@@ -0,0 +1,57 @@
+--- contrib/libs/jinja2cpp/src/internal_value.cpp (index)
++++ contrib/libs/jinja2cpp/src/internal_value.cpp (working tree)
+@@ -8,6 +8,20 @@
+ namespace jinja2
+ {
+
++void InternalValue::SetParentData(const InternalValue& val) {
++ m_parentData = val.GetData();
++}
++
++void InternalValue::SetParentData(InternalValue&& val) {
++ m_parentData = std::move(val.GetData());
++}
++
++void ListAdapter::Iterator::increment() {
++ m_isFinished = !m_iterator->MoveNext();
++ ++ m_currentIndex;
++ m_currentVal = m_isFinished ? InternalValue() : m_iterator->GetCurrent();
++}
++
+ std::atomic_uint64_t UserCallable::m_gen{};
+
+ bool Value::IsEqual(const Value& rhs) const
+--- contrib/libs/jinja2cpp/src/internal_value.h (index)
++++ contrib/libs/jinja2cpp/src/internal_value.h (working tree)
+@@ -382,15 +382,9 @@ public:
+ auto& GetParentData() {return m_parentData;}
+ auto& GetParentData() const {return m_parentData;}
+
+- void SetParentData(const InternalValue& val)
+- {
+- m_parentData = val.GetData();
+- }
++ void SetParentData(const InternalValue& val);
+
+- void SetParentData(InternalValue&& val)
+- {
+- m_parentData = std::move(val.GetData());
+- }
++ void SetParentData(InternalValue&& val);
+
+ bool ShouldExtendLifetime() const
+ {
+@@ -444,12 +438,7 @@ public:
+ private:
+ friend class boost::iterator_core_access;
+
+- void increment()
+- {
+- m_isFinished = !m_iterator->MoveNext();
+- ++ m_currentIndex;
+- m_currentVal = m_isFinished ? InternalValue() : m_iterator->GetCurrent();
+- }
++ void increment();
+
+ bool equal(const Iterator& other) const
+ {
diff --git a/contrib/libs/jinja2cpp/patches/iterators.patch b/contrib/libs/jinja2cpp/patches/iterators.patch
new file mode 100644
index 00000000000..a92a9cd4a37
--- /dev/null
+++ b/contrib/libs/jinja2cpp/patches/iterators.patch
@@ -0,0 +1,11 @@
+--- a/src/string_converter_filter.cpp (index)
++++ b/src/string_converter_filter.cpp (working tree)
+@@ -379,7 +379,7 @@ InternalValue StringConverter::Filter(const InternalValue& baseVal, RenderContex
+ if (string_length >= width)
+ return str;
+ auto whitespaces = width - string_length;
+- str.insert(0, static_cast<std::string::size_type>(whitespaces + 1) / 2, ' ');
++ str = decltype(str)(static_cast<std::string::size_type>(whitespaces + 1) / 2, ' ') + str;
+ str.append(static_cast<std::string::size_type>(whitespaces / 2), ' ');
+ return TargetString(std::move(str));
+ });
diff --git a/contrib/libs/jinja2cpp/patches/pr-259-fix_qadric_tojson.patch b/contrib/libs/jinja2cpp/patches/pr-259-fix_qadric_tojson.patch
new file mode 100644
index 00000000000..569aa4875e7
--- /dev/null
+++ b/contrib/libs/jinja2cpp/patches/pr-259-fix_qadric_tojson.patch
@@ -0,0 +1,43 @@
+--- contrib/libs/jinja2cpp/src/serialize_filters.cpp (index)
++++ contrib/libs/jinja2cpp/src/serialize_filters.cpp (working tree)
+@@ -152,27 +152,20 @@ InternalValue Serialize::Filter(const InternalValue& value, RenderContext& conte
+ DocumentWrapper jsonDoc;
+ const auto jsonValue = jsonDoc.CreateValue(value);
+ const auto jsonString = jsonValue.AsString(static_cast<uint8_t>(indent));
+- const auto result = std::accumulate(jsonString.begin(), jsonString.end(), ""s, [](const auto &str, const auto &c)
+- {
+- switch (c)
+- {
+- case '<':
+- return str + "\\u003c";
+- break;
+- case '>':
+- return str +"\\u003e";
+- break;
+- case '&':
+- return str +"\\u0026";
+- break;
+- case '\'':
+- return str +"\\u0027";
+- break;
+- default:
+- return str + c;
+- break;
++ std::string result = ""s;
++ for (char c : jsonString) {
++ if (c == '<') {
++ result.append("\\u003c");
++ } else if (c == '>') {
++ result.append("\\u003e");
++ } else if (c == '&') {
++ result.append("\\u0026");
++ } else if (c == '\'') {
++ result.append("\\u0027");
++ } else {
++ result.push_back(c);
+ }
+- });
++ }
+
+ return result;
+ }
diff --git a/contrib/libs/miniselect/.yandex_meta/__init__.py b/contrib/libs/miniselect/.yandex_meta/__init__.py
new file mode 100644
index 00000000000..48c4b79fe97
--- /dev/null
+++ b/contrib/libs/miniselect/.yandex_meta/__init__.py
@@ -0,0 +1,17 @@
+from devtools.yamaker.modules import Library
+from devtools.yamaker.project import NixSourceProject
+
+
+def post_install(self):
+ self.yamakes["."] = self.module(Library)
+
+
+miniselect = NixSourceProject(
+ nixattr="miniselect",
+ arcdir="contrib/libs/miniselect",
+ owners=["g:cpp-contrib"],
+ copy_sources=[
+ "include/",
+ ],
+ post_install=post_install,
+)
diff --git a/contrib/libs/miniselect/.yandex_meta/default.nix b/contrib/libs/miniselect/.yandex_meta/default.nix
new file mode 100644
index 00000000000..3e141c966c6
--- /dev/null
+++ b/contrib/libs/miniselect/.yandex_meta/default.nix
@@ -0,0 +1,14 @@
+self: super: with self; with pkgs; {
+ miniselect = stdenv.mkDerivation rec {
+ pname = "miniselect";
+ version = "0.4.0";
+
+ src = fetchFromGitHub {
+ owner = "danlark1";
+ repo = "miniselect";
+ rev = "${version}";
+ hash = "sha256-dcV70u7ey07/ttfLbaOIOJb4/uSP2rYXDa4RmRC+u6M=";
+ };
+
+ };
+}
diff --git a/contrib/libs/pdqsort/.yandex_meta/__init__.py b/contrib/libs/pdqsort/.yandex_meta/__init__.py
new file mode 100644
index 00000000000..cb885ab1b65
--- /dev/null
+++ b/contrib/libs/pdqsort/.yandex_meta/__init__.py
@@ -0,0 +1,14 @@
+from devtools.yamaker.modules import Library
+from devtools.yamaker.project import NixSourceProject
+
+
+def post_install(self):
+ self.yamakes["."] = self.module(Library)
+
+
+pdqsort = NixSourceProject(
+ nixattr="pdqsort",
+ arcdir="contrib/libs/pdqsort",
+ copy_sources=["license.txt", "pdqsort.h"],
+ post_install=post_install,
+)
diff --git a/contrib/libs/pdqsort/.yandex_meta/default.nix b/contrib/libs/pdqsort/.yandex_meta/default.nix
new file mode 100644
index 00000000000..dff3b2b4717
--- /dev/null
+++ b/contrib/libs/pdqsort/.yandex_meta/default.nix
@@ -0,0 +1,13 @@
+self: super: with self; {
+ pdqsort = stdenv.mkDerivation rec {
+ pname = "pdqsort";
+ version = "2021-03-14";
+
+ src = fetchFromGitHub {
+ owner = "orlp";
+ repo = "pdqsort";
+ rev = "b1ef26a55cdb60d236a5cb199c4234c704f46726";
+ hash = "sha256-xn3Jjn/jxJBckpg1Tx3HHVAWYPVTFMiDFiYgB2WX7Sc=";
+ };
+ };
+}
diff --git a/contrib/libs/t1ha/.yandex_meta/__init__.py b/contrib/libs/t1ha/.yandex_meta/__init__.py
new file mode 100644
index 00000000000..b3a14856fb6
--- /dev/null
+++ b/contrib/libs/t1ha/.yandex_meta/__init__.py
@@ -0,0 +1,19 @@
+from devtools.yamaker.project import GNUMakeNixProject
+from devtools.yamaker.modules import Switch, Linkable
+
+
+def post_install(self):
+ with self.yamakes["."] as t1ha:
+ t1ha.after("SRCS", Switch(ARCH_X86_64=Linkable(CFLAGS=["-maes"])))
+
+
+t1ha = GNUMakeNixProject(
+ owners=["g:cpp-contrib"],
+ arcdir="contrib/libs/t1ha",
+ nixattr="t1ha",
+ makeflags=["libt1ha.so"],
+ disable_includes=[
+ "sys/isa_defs.h",
+ ],
+ post_install=post_install,
+)
diff --git a/contrib/libs/t1ha/.yandex_meta/default.nix b/contrib/libs/t1ha/.yandex_meta/default.nix
new file mode 100644
index 00000000000..8a475a542a7
--- /dev/null
+++ b/contrib/libs/t1ha/.yandex_meta/default.nix
@@ -0,0 +1,15 @@
+self: super: with self; {
+ t1ha = stdenv.mkDerivation rec {
+ pname = "t1ha";
+ version = "2.1.4";
+
+ src = fetchFromGitHub {
+ owner = "PositiveTechnologies";
+ repo = "t1ha";
+ rev = "v${version}";
+ sha256 = "01l6rd401z9y67lns7fdyp0kr69irkjmnpiwq4rvzf0gk0l2bvzd";
+ };
+
+ doCheck = true;
+ };
+}
diff --git a/contrib/libs/t1ha/patches/clang-cl.patch b/contrib/libs/t1ha/patches/clang-cl.patch
new file mode 100644
index 00000000000..4d77e3715be
--- /dev/null
+++ b/contrib/libs/t1ha/patches/clang-cl.patch
@@ -0,0 +1,5 @@
+--- a/src/t1ha0.c (44cadc7fea4c04518cd850f024c8561d18e228e0)
++++ b/src/t1ha0.c (1327e1c4adff73eca2f0de6afee8b1a31967ef8b)
+@@ -361,1 +361,1 @@ uint64_t t1ha0_32be(const void *data, size_t len, uint64_t seed) {
+-#ifdef __GNUC__
++#if defined(__GNUC__) || defined(__clang__)
diff --git a/contrib/libs/t1ha/patches/sanitizer.patch b/contrib/libs/t1ha/patches/sanitizer.patch
new file mode 100644
index 00000000000..3a97660fefc
--- /dev/null
+++ b/contrib/libs/t1ha/patches/sanitizer.patch
@@ -0,0 +1,17 @@
+--- a/t1ha.h (44cadc7fea4c04518cd850f024c8561d18e228e0)
++++ b/t1ha.h (1327e1c4adff73eca2f0de6afee8b1a31967ef8b)
+@@ -377,6 +377,8 @@
+ #define T1HA_ALIGN_SUFFIX
+ #endif /* GCC x86 */
+
++#include <util/system/compiler.h>
++
+ #ifndef T1HA_USE_INDIRECT_FUNCTIONS
+ /* GNU ELF indirect functions usage control. For more info please see
+ * https://en.wikipedia.org/wiki/Executable_and_Linkable_Format
+@@ 386,4 +386,4 @@
+ #if defined(__ELF__) && defined(__amd64__) && \
+ (__has_attribute(__ifunc__) || \
+ (!defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 4 && \
+- !defined(__SANITIZE_ADDRESS__) && !defined(__SSP_ALL__)))
++ !defined(_asan_enabled_) && !defined(_tsan_enabled_) && !defined(__SSP_ALL__)))
diff --git a/contrib/python/marisa-trie/py3/.dist-info/METADATA b/contrib/python/marisa-trie/py3/.dist-info/METADATA
index 8d866d15b8b..e35eeee19f6 100644
--- a/contrib/python/marisa-trie/py3/.dist-info/METADATA
+++ b/contrib/python/marisa-trie/py3/.dist-info/METADATA
@@ -1,49 +1,53 @@
-Metadata-Version: 2.1
+Metadata-Version: 2.4
Name: marisa-trie
-Version: 1.2.1
+Version: 1.3.0
Summary: Static memory-efficient and fast Trie-like structures for Python.
-Home-page: https://github.com/pytries/marisa-trie
-Author: Mikhail Korobov
-Author-email: [email protected]
-License: MIT
+Author-email: Mikhail Korobov <[email protected]>
+License-Expression: MIT AND (BSD-2-Clause OR LGPL-2.1-or-later)
+Project-URL: Source, https://github.com/pytries/marisa-trie
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
-Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Cython
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.7
-Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
+Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Text Processing :: Linguistic
-Requires-Python: >=3.7
+Requires-Python: >=3.9
Description-Content-Type: text/x-rst
-License-File: LICENSE
License-File: AUTHORS.rst
-Requires-Dist: setuptools
+License-File: LICENSE
+License-File: marisa-trie/AUTHORS
+License-File: marisa-trie/COPYING.md
Provides-Extra: test
Requires-Dist: hypothesis; extra == "test"
Requires-Dist: pytest; extra == "test"
-Requires-Dist: readme-renderer; extra == "test"
+Requires-Dist: readme_renderer; extra == "test"
+Dynamic: license-file
MARISA Trie
===========
-.. image:: https://img.shields.io/pypi/pyversions/marisa-trie.svg
- :target: https://pypi.python.org/pypi/marisa-trie
+|PyPI Version|
+|PyPI Status|
+|PyPI Python Versions|
+|Github Build Status|
-.. image:: https://github.com/pytries/marisa-trie/actions/workflows/tests.yml/badge.svg
- :target: https://github.com/pytries/marisa-trie/actions/workflows/tests.yml
+.. tip::
+
+ Become **my boss** to help me work on this awesome software, and make the world better:
+
+ |Patreon|
-Static memory-efficient Trie-like structures for Python (3.7+)
+Static memory-efficient Trie-like structures for Python (3.8+)
based on `marisa-trie`_ C++ library.
String data in a MARISA-trie may take up to 50x-100x less memory than
@@ -89,11 +93,34 @@ License
Wrapper code is licensed under MIT License.
Bundled `marisa-trie`_ C++ library is dual-licensed under
-LGPL and BSD 2-clause license.
+LGPL or BSD 2-clause license.
+
+.. |PyPI Version| image:: https://img.shields.io/pypi/v/marisa-trie.svg
+ :target: https://pypi.python.org/pypi/marisa-trie/
+.. |PyPI Status| image:: https://img.shields.io/pypi/status/marisa-trie.svg
+ :target: https://pypi.python.org/pypi/marisa-trie/
+.. |PyPI Python Versions| image:: https://img.shields.io/pypi/pyversions/marisa-trie.svg
+ :target: https://pypi.python.org/pypi/marisa-trie/
+.. |Github Build Status| image:: https://github.com/pytries/marisa-trie/actions/workflows/tests.yml/badge.svg
+ :target: https://github.com/pytries/marisa-trie/actions/workflows/tests.yml
+.. |Patreon| image:: https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white
+ :target: https://www.patreon.com/mschoentgen
+
CHANGES
=======
+1.3.0 (2025-08-16)
+------------------
+
+* Updated ``libmarisa-trie`` to the latest version (0.2.7) (#116).
+* Dropped Python 3.7, 3.8 support (#112, #120).
+* Added Python 3.13 support (#112).
+* Rebuild Cython wrapper with Cython 3.1.3 (#119, [4d564de](4d564de332191c3fe33aa2240cae2494c597bba2)).
+* Moved static project metadata to ``pyproject.toml`` (#120).
+* Updated metadata license to include the bundled one from marisa-trie as well (#120).
+* Add Cython as build dependency (#122).
+
1.2.1 (2024-10-12)
------------------
diff --git a/contrib/python/marisa-trie/py3/.yandex_meta/yamaker.yaml b/contrib/python/marisa-trie/py3/.yandex_meta/yamaker.yaml
index bfd4439ead4..d84dbcdbe72 100644
--- a/contrib/python/marisa-trie/py3/.yandex_meta/yamaker.yaml
+++ b/contrib/python/marisa-trie/py3/.yandex_meta/yamaker.yaml
@@ -3,3 +3,5 @@ cython_directive:
copy:
- marisa-trie/*
- src/*
+exclude:
+ - src/marisa_trie.egg-info/*
diff --git a/contrib/python/marisa-trie/py3/AUTHORS b/contrib/python/marisa-trie/py3/AUTHORS
new file mode 100644
index 00000000000..4ee985a7ba7
--- /dev/null
+++ b/contrib/python/marisa-trie/py3/AUTHORS
@@ -0,0 +1 @@
+Susumu Yata <[email protected]>
diff --git a/contrib/python/marisa-trie/py3/COPYING.md b/contrib/python/marisa-trie/py3/COPYING.md
new file mode 100644
index 00000000000..64c9ce64bf1
--- /dev/null
+++ b/contrib/python/marisa-trie/py3/COPYING.md
@@ -0,0 +1,34 @@
+### COPYING
+
+libmarisa and its command line tools are licensed under BSD-2-Clause OR LGPL-2.1-or-later.
+
+#### The BSD 2-clause license
+
+Copyright (c) 2010-2025, Susumu Yata
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 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.
+- 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.
+
+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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 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.
+
+#### The LGPL 2.1 or any later version
+
+marisa-trie - A static and space-efficient trie data structure.
+Copyright (C) 2010-2025 Susumu Yata
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/contrib/python/marisa-trie/py3/LICENSE b/contrib/python/marisa-trie/py3/LICENSE
index e65b3446adb..4581b9d6b8f 100644
--- a/contrib/python/marisa-trie/py3/LICENSE
+++ b/contrib/python/marisa-trie/py3/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) marisa-trie authors and contributors, 2012-2024
+Copyright (c) marisa-trie authors and contributors, 2012-2025
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/contrib/python/marisa-trie/py3/README.rst b/contrib/python/marisa-trie/py3/README.rst
index 0f123a32860..20ae047486b 100644
--- a/contrib/python/marisa-trie/py3/README.rst
+++ b/contrib/python/marisa-trie/py3/README.rst
@@ -1,13 +1,18 @@
MARISA Trie
===========
-.. image:: https://img.shields.io/pypi/pyversions/marisa-trie.svg
- :target: https://pypi.python.org/pypi/marisa-trie
+|PyPI Version|
+|PyPI Status|
+|PyPI Python Versions|
+|Github Build Status|
-.. image:: https://github.com/pytries/marisa-trie/actions/workflows/tests.yml/badge.svg
- :target: https://github.com/pytries/marisa-trie/actions/workflows/tests.yml
+.. tip::
+
+ Become **my boss** to help me work on this awesome software, and make the world better:
-Static memory-efficient Trie-like structures for Python (3.7+)
+ |Patreon|
+
+Static memory-efficient Trie-like structures for Python (3.8+)
based on `marisa-trie`_ C++ library.
String data in a MARISA-trie may take up to 50x-100x less memory than
@@ -53,4 +58,15 @@ License
Wrapper code is licensed under MIT License.
Bundled `marisa-trie`_ C++ library is dual-licensed under
-LGPL and BSD 2-clause license.
+LGPL or BSD 2-clause license.
+
+.. |PyPI Version| image:: https://img.shields.io/pypi/v/marisa-trie.svg
+ :target: https://pypi.python.org/pypi/marisa-trie/
+.. |PyPI Status| image:: https://img.shields.io/pypi/status/marisa-trie.svg
+ :target: https://pypi.python.org/pypi/marisa-trie/
+.. |PyPI Python Versions| image:: https://img.shields.io/pypi/pyversions/marisa-trie.svg
+ :target: https://pypi.python.org/pypi/marisa-trie/
+.. |Github Build Status| image:: https://github.com/pytries/marisa-trie/actions/workflows/tests.yml/badge.svg
+ :target: https://github.com/pytries/marisa-trie/actions/workflows/tests.yml
+.. |Patreon| image:: https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white
+ :target: https://www.patreon.com/mschoentgen
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/AUTHORS b/contrib/python/marisa-trie/py3/marisa-trie/AUTHORS
new file mode 100644
index 00000000000..4ee985a7ba7
--- /dev/null
+++ b/contrib/python/marisa-trie/py3/marisa-trie/AUTHORS
@@ -0,0 +1 @@
+Susumu Yata <[email protected]>
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/COPYING.md b/contrib/python/marisa-trie/py3/marisa-trie/COPYING.md
new file mode 100644
index 00000000000..64c9ce64bf1
--- /dev/null
+++ b/contrib/python/marisa-trie/py3/marisa-trie/COPYING.md
@@ -0,0 +1,34 @@
+### COPYING
+
+libmarisa and its command line tools are licensed under BSD-2-Clause OR LGPL-2.1-or-later.
+
+#### The BSD 2-clause license
+
+Copyright (c) 2010-2025, Susumu Yata
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 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.
+- 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.
+
+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 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 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.
+
+#### The LGPL 2.1 or any later version
+
+marisa-trie - A static and space-efficient trie data structure.
+Copyright (C) 2010-2025 Susumu Yata
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/agent.h b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/agent.h
index c72dea755d4..b549d36804e 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/agent.h
+++ b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/agent.h
@@ -1,6 +1,10 @@
#ifndef MARISA_AGENT_H_
#define MARISA_AGENT_H_
+#if __cplusplus >= 201703L
+ #include <string_view>
+#endif // __cplusplus >= 201703L
+
#include "marisa/key.h"
#include "marisa/query.h"
@@ -25,6 +29,11 @@ class Agent {
return key_;
}
+#if __cplusplus >= 201703L
+ void set_query(std::string_view str) {
+ set_query(str.data(), str.length());
+ }
+#endif // __cplusplus >= 201703L
void set_query(const char *str);
void set_query(const char *ptr, std::size_t length);
void set_query(std::size_t key_id);
@@ -36,6 +45,11 @@ class Agent {
return *state_;
}
+#if __cplusplus >= 201703L
+ void set_key(std::string_view str) {
+ set_key(str.data(), str.length());
+ }
+#endif // __cplusplus >= 201703L
void set_key(const char *str) {
MARISA_DEBUG_IF(str == NULL, MARISA_NULL_ERROR);
key_.set_str(str);
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/base.h b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/base.h
index ffcdc5bd8cc..bc90b243371 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/base.h
+++ b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/base.h
@@ -1,10 +1,7 @@
#ifndef MARISA_BASE_H_
#define MARISA_BASE_H_
-// Old Visual C++ does not provide stdint.h.
-#ifndef _MSC_VER
- #include <stdint.h>
-#endif // _MSC_VER
+#include <stdint.h>
#ifdef __cplusplus
#include <cstddef>
@@ -28,14 +25,13 @@ typedef uint32_t marisa_uint32;
typedef uint64_t marisa_uint64;
#endif // _MSC_VER
-#if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) || \
- defined(__ia64__) || defined(__ppc64__) || defined(__powerpc64__) || \
- defined(__sparc64__) || defined(__mips64__) || defined(__aarch64__) || \
- defined(__s390x__)
+#if UINTPTR_MAX == UINT64_MAX
#define MARISA_WORD_SIZE 64
-#else // defined(_WIN64), etc.
+#elif UINTPTR_MAX == UINT32_MAX
#define MARISA_WORD_SIZE 32
-#endif // defined(_WIN64), etc.
+#else
+ #error Failed to detect MARISA_WORD_SIZE
+#endif
//#define MARISA_WORD_SIZE (sizeof(void *) * 8)
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/exception.h b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/exception.h
index c4a93aa4978..e3e7d757e54 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/exception.h
+++ b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/exception.h
@@ -3,7 +3,8 @@
#include <exception>
-#include "marisa/base.h"
+// Please don't #include this header directly.
+// This header is #included from "marisa/base.h".
namespace marisa {
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/key.h b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/key.h
index 8b2cf8fcf8a..9ab7dae3824 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/key.h
+++ b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/key.h
@@ -1,6 +1,10 @@
#ifndef MARISA_KEY_H_
#define MARISA_KEY_H_
+#if __cplusplus >= 201703L
+ #include <string_view>
+#endif // __cplusplus >= 201703L
+
#include "marisa/base.h"
namespace marisa {
@@ -25,6 +29,11 @@ class Key {
return ptr_[i];
}
+#if __cplusplus >= 201703L
+ void set_str(std::string_view str) {
+ set_str(str.data(), str.length());
+ }
+#endif // __cplusplus >= 201703L
void set_str(const char *str) {
MARISA_DEBUG_IF(str == NULL, MARISA_NULL_ERROR);
std::size_t length = 0;
@@ -49,6 +58,11 @@ class Key {
union_.weight = weight;
}
+#if __cplusplus >= 201703L
+ std::string_view str() const {
+ return std::string_view(ptr_, length_);
+ }
+#endif // __cplusplus >= 201703L
const char *ptr() const {
return ptr_;
}
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/keyset.h b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/keyset.h
index e575015c0c3..9d5e9e97150 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/keyset.h
+++ b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/keyset.h
@@ -1,6 +1,10 @@
#ifndef MARISA_KEYSET_H_
#define MARISA_KEYSET_H_
+#if __cplusplus >= 201703L
+ #include <string_view>
+#endif // __cplusplus >= 201703L
+
#include "marisa/key.h"
namespace marisa {
@@ -18,6 +22,11 @@ class Keyset {
void push_back(const Key &key);
void push_back(const Key &key, char end_marker);
+#if __cplusplus >= 201703L
+ void push_back(std::string_view str, float weight = 1.0) {
+ push_back(str.data(), str.length(), weight);
+ }
+#endif // __cplusplus >= 201703L
void push_back(const char *str);
void push_back(const char *ptr, std::size_t length, float weight = 1.0);
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/query.h b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/query.h
index 316e741a8fa..03f51e2c950 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/query.h
+++ b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/query.h
@@ -1,6 +1,10 @@
#ifndef MARISA_QUERY_H_
#define MARISA_QUERY_H_
+#if __cplusplus >= 201703L
+ #include <string_view>
+#endif // __cplusplus >= 201703L
+
#include "marisa/base.h"
namespace marisa {
@@ -23,6 +27,11 @@ class Query {
return ptr_[i];
}
+#if __cplusplus >= 201703L
+ void set_str(std::string_view str) {
+ set_str(str.data(), str.length());
+ }
+#endif // __cplusplus >= 201703L
void set_str(const char *str) {
MARISA_DEBUG_IF(str == NULL, MARISA_NULL_ERROR);
std::size_t length = 0;
@@ -41,6 +50,11 @@ class Query {
id_ = id;
}
+#if __cplusplus >= 201703L
+ std::string_view str() const {
+ return std::string_view(ptr_, length_);
+ }
+#endif // __cplusplus >= 201703L
const char *ptr() const {
return ptr_;
}
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-array.h b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-array.h
index 12b5b9e7f83..0a7ae646cf3 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-array.h
+++ b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-array.h
@@ -1,7 +1,8 @@
#ifndef MARISA_SCOPED_ARRAY_H_
#define MARISA_SCOPED_ARRAY_H_
-#include "marisa/base.h"
+// Please don't #include this header directly.
+// This header is #included from "marisa/base.h".
namespace marisa {
@@ -16,7 +17,7 @@ class scoped_array {
}
void reset(T *array = NULL) {
- MARISA_THROW_IF((array != NULL) && (array == array_), MARISA_RESET_ERROR);
+ MARISA_DEBUG_IF((array != NULL) && (array == array_), MARISA_RESET_ERROR);
scoped_array(array).swap(*this);
}
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-ptr.h b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-ptr.h
index 63d7a3dcc92..a8f756b23ec 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-ptr.h
+++ b/contrib/python/marisa-trie/py3/marisa-trie/include/marisa/scoped-ptr.h
@@ -1,7 +1,8 @@
#ifndef MARISA_SCOPED_PTR_H_
#define MARISA_SCOPED_PTR_H_
-#include "marisa/base.h"
+// Please don't #include this header directly.
+// This header is #included from "marisa/base.h".
namespace marisa {
@@ -16,7 +17,7 @@ class scoped_ptr {
}
void reset(T *ptr = NULL) {
- MARISA_THROW_IF((ptr != NULL) && (ptr == ptr_), MARISA_RESET_ERROR);
+ MARISA_DEBUG_IF((ptr != NULL) && (ptr == ptr_), MARISA_RESET_ERROR);
scoped_ptr(ptr).swap(*this);
}
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/algorithm/sort.h b/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/algorithm/sort.h
index 5f3b6526bda..89c16318ed8 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/algorithm/sort.h
+++ b/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/algorithm/sort.h
@@ -187,7 +187,7 @@ template <typename Iterator>
std::size_t sort(Iterator begin, Iterator end) {
MARISA_DEBUG_IF(begin > end, MARISA_BOUND_ERROR);
return details::sort(begin, end, 0);
-};
+}
} // namespace algorithm
} // namespace grimoire
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/io/mapper.cc b/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/io/mapper.cc
index 6ae0ee37f39..44688acb378 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/io/mapper.cc
+++ b/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/io/mapper.cc
@@ -112,20 +112,15 @@ const void *Mapper::map_data(std::size_t size) {
#endif // __MSVCRT_VERSION__ >= 0x0601
#endif // __MSVCRT_VERSION__
void Mapper::open_(const char *filename) {
- #ifdef MARISA_HAS_STAT64
- struct __stat64 st;
- MARISA_THROW_IF(::_stat64(filename, &st) != 0, MARISA_IO_ERROR);
- #else // MARISA_HAS_STAT64
- struct _stat st;
- MARISA_THROW_IF(::_stat(filename, &st) != 0, MARISA_IO_ERROR);
- #endif // MARISA_HAS_STAT64
- MARISA_THROW_IF((UInt64)st.st_size > MARISA_SIZE_MAX, MARISA_SIZE_ERROR);
- size_ = (std::size_t)st.st_size;
-
file_ = ::CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
MARISA_THROW_IF(file_ == INVALID_HANDLE_VALUE, MARISA_IO_ERROR);
+ DWORD size_high, size_low;
+ size_low = ::GetFileSize(file_, &size_high);
+ MARISA_THROW_IF(size_low == INVALID_FILE_SIZE, MARISA_IO_ERROR);
+ size_ = ((std::size_t)size_high << 32) | size_low;
+
map_ = ::CreateFileMapping(file_, NULL, PAGE_READONLY, 0, 0, NULL);
MARISA_THROW_IF(map_ == NULL, MARISA_IO_ERROR);
@@ -137,14 +132,14 @@ void Mapper::open_(const char *filename) {
}
#else // (defined _WIN32) || (defined _WIN64)
void Mapper::open_(const char *filename) {
+ fd_ = ::open(filename, O_RDONLY);
+ MARISA_THROW_IF(fd_ == -1, MARISA_IO_ERROR);
+
struct stat st;
- MARISA_THROW_IF(::stat(filename, &st) != 0, MARISA_IO_ERROR);
+ MARISA_THROW_IF(::fstat(fd_, &st) != 0, MARISA_IO_ERROR);
MARISA_THROW_IF((UInt64)st.st_size > MARISA_SIZE_MAX, MARISA_SIZE_ERROR);
size_ = (std::size_t)st.st_size;
- fd_ = ::open(filename, O_RDONLY);
- MARISA_THROW_IF(fd_ == -1, MARISA_IO_ERROR);
-
origin_ = ::mmap(NULL, size_, PROT_READ, MAP_SHARED, fd_, 0);
MARISA_THROW_IF(origin_ == MAP_FAILED, MARISA_IO_ERROR);
diff --git a/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/vector/bit-vector.cc b/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/vector/bit-vector.cc
index 60ded67fe63..80c1f49b175 100644
--- a/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/vector/bit-vector.cc
+++ b/contrib/python/marisa-trie/py3/marisa-trie/lib/marisa/grimoire/vector/bit-vector.cc
@@ -1,3 +1,5 @@
+#include <algorithm>
+
#include "marisa/grimoire/vector/pop-count.h"
#include "marisa/grimoire/vector/bit-vector.h"
@@ -337,7 +339,44 @@ std::size_t select_bit(std::size_t i, std::size_t bit_id,
return bit_id + SELECT_TABLE[i][byte];
}
+ #else // MARISA_USE_SSE2
+std::size_t select_bit(std::size_t i, std::size_t bit_id,
+ UInt32 unit_lo, UInt32 unit_hi) {
+ UInt32 unit = unit_lo;
+ PopCount count(unit);
+ if (i >= count.lo32()) {
+ bit_id += 32;
+ i -= count.lo32();
+ unit = unit_hi;
+ count = PopCount(unit);
+ }
+
+ if (i < count.lo16()) {
+ if (i >= count.lo8()) {
+ bit_id += 8;
+ unit >>= 8;
+ i -= count.lo8();
+ }
+ } else if (i < count.lo24()) {
+ bit_id += 16;
+ unit >>= 16;
+ i -= count.lo16();
+ } else {
+ bit_id += 24;
+ unit >>= 24;
+ i -= count.lo24();
+ }
+ return bit_id + SELECT_TABLE[i][unit & 0xFF];
+}
#endif // MARISA_USE_SSE2
+
+
+// This is only used by build_index, so don't worry about the small performance
+// penalty from not having version taking only a UInt32.
+inline std::size_t select_bit(std::size_t i, std::size_t bit_id, UInt32 unit) {
+ return select_bit(i, bit_id, /*unit_lo=*/unit, /*unit_hi=*/0);
+}
+
#endif // MARISA_WORD_SIZE == 64
#endif // MARISA_USE_BMI2
@@ -613,36 +652,7 @@ std::size_t BitVector::select0(std::size_t i) const {
i -= 448 - rank.rel7();
}
-#ifdef MARISA_USE_SSE2
return select_bit(i, unit_id * 32, ~units_[unit_id], ~units_[unit_id + 1]);
-#else // MARISA_USE_SSE2
- UInt32 unit = ~units_[unit_id];
- PopCount count(unit);
- if (i >= count.lo32()) {
- ++unit_id;
- i -= count.lo32();
- unit = ~units_[unit_id];
- count = PopCount(unit);
- }
-
- std::size_t bit_id = unit_id * 32;
- if (i < count.lo16()) {
- if (i >= count.lo8()) {
- bit_id += 8;
- unit >>= 8;
- i -= count.lo8();
- }
- } else if (i < count.lo24()) {
- bit_id += 16;
- unit >>= 16;
- i -= count.lo16();
- } else {
- bit_id += 24;
- unit >>= 24;
- i -= count.lo24();
- }
- return bit_id + SELECT_TABLE[i][unit & 0xFF];
-#endif // MARISA_USE_SSE2
}
std::size_t BitVector::select1(std::size_t i) const {
@@ -704,51 +714,26 @@ std::size_t BitVector::select1(std::size_t i) const {
i -= rank.rel7();
}
-#ifdef MARISA_USE_SSE2
return select_bit(i, unit_id * 32, units_[unit_id], units_[unit_id + 1]);
-#else // MARISA_USE_SSE2
- UInt32 unit = units_[unit_id];
- PopCount count(unit);
- if (i >= count.lo32()) {
- ++unit_id;
- i -= count.lo32();
- unit = units_[unit_id];
- count = PopCount(unit);
- }
-
- std::size_t bit_id = unit_id * 32;
- if (i < count.lo16()) {
- if (i >= count.lo8()) {
- bit_id += 8;
- unit >>= 8;
- i -= count.lo8();
- }
- } else if (i < count.lo24()) {
- bit_id += 16;
- unit >>= 16;
- i -= count.lo16();
- } else {
- bit_id += 24;
- unit >>= 24;
- i -= count.lo24();
- }
- return bit_id + SELECT_TABLE[i][unit & 0xFF];
-#endif // MARISA_USE_SSE2
}
#endif // MARISA_WORD_SIZE == 64
void BitVector::build_index(const BitVector &bv,
bool enables_select0, bool enables_select1) {
- ranks_.resize((bv.size() / 512) + (((bv.size() % 512) != 0) ? 1 : 0) + 1);
+ const std::size_t num_bits = bv.size();
+ ranks_.resize((num_bits / 512) + (((num_bits % 512) != 0) ? 1 : 0) + 1);
- std::size_t num_0s = 0;
+ std::size_t num_0s = 0; // Only updated if enables_select0 is true.
std::size_t num_1s = 0;
- for (std::size_t i = 0; i < bv.size(); ++i) {
- if ((i % 64) == 0) {
- const std::size_t rank_id = i / 512;
- switch ((i / 64) % 8) {
+ const std::size_t num_units = bv.units_.size();
+ for (std::size_t unit_id = 0; unit_id < num_units; ++unit_id) {
+ const std::size_t bit_id = unit_id * MARISA_WORD_SIZE;
+
+ if ((bit_id % 64) == 0) {
+ const std::size_t rank_id = bit_id / 512;
+ switch ((bit_id / 64) % 8) {
case 0: {
ranks_[rank_id].set_abs(num_1s);
break;
@@ -784,22 +769,47 @@ void BitVector::build_index(const BitVector &bv,
}
}
- if (bv[i]) {
- if (enables_select1 && ((num_1s % 512) == 0)) {
- select1s_.push_back(static_cast<UInt32>(i));
+ const Unit unit = bv.units_[unit_id];
+ // push_back resizes with 0, so the high bits of the last unit are 0 and
+ // do not affect the 1s count.
+ const std::size_t unit_num_1s = PopCount::count(unit);
+
+ if (enables_select0) {
+ // num_0s is somewhat move involved to compute, so only do it if we
+ // need it. The last word has zeros in the high bits, so that needs
+ // to be accounted for when computing the unit_num_0s from unit_num_1s.
+ const std::size_t bits_remaining = num_bits - bit_id;
+ const std::size_t unit_num_0s =
+ std::min<std::size_t>(bits_remaining, MARISA_WORD_SIZE) - unit_num_1s;
+
+ // Note: MSVC rejects unary minus operator applied to unsigned type.
+ const std::size_t zero_bit_id = (0 - num_0s) % 512;
+ if (unit_num_0s > zero_bit_id) {
+ // select0s_ is UInt32, but select_bit returns size_t, so cast to
+ // suppress narrowing conversion warning. push_back checks the
+ // size, so there is no truncation here.
+ select0s_.push_back(
+ static_cast<UInt32>(select_bit(zero_bit_id, bit_id, ~unit)));
}
- ++num_1s;
- } else {
- if (enables_select0 && ((num_0s % 512) == 0)) {
- select0s_.push_back(static_cast<UInt32>(i));
+
+ num_0s += unit_num_0s;
+ }
+
+ if (enables_select1) {
+ // Note: MSVC rejects unary minus operator applied to unsigned type.
+ const std::size_t one_bit_id = (0 - num_1s) % 512;
+ if (unit_num_1s > one_bit_id) {
+ select1s_.push_back(
+ static_cast<UInt32>(select_bit(one_bit_id, bit_id, unit)));
}
- ++num_0s;
}
+
+ num_1s += unit_num_1s;
}
- if ((bv.size() % 512) != 0) {
- const std::size_t rank_id = (bv.size() - 1) / 512;
- switch (((bv.size() - 1) / 64) % 8) {
+ if ((num_bits % 512) != 0) {
+ const std::size_t rank_id = (num_bits - 1) / 512;
+ switch (((num_bits - 1) / 64) % 8) {
case 0: {
ranks_[rank_id].set_rel1(num_1s - ranks_[rank_id].abs());
} // fall through
@@ -825,16 +835,16 @@ void BitVector::build_index(const BitVector &bv,
}
}
- size_ = bv.size();
+ size_ = num_bits;
num_1s_ = bv.num_1s();
ranks_.back().set_abs(num_1s);
if (enables_select0) {
- select0s_.push_back(static_cast<UInt32>(bv.size()));
+ select0s_.push_back(static_cast<UInt32>(num_bits));
select0s_.shrink();
}
if (enables_select1) {
- select1s_.push_back(static_cast<UInt32>(bv.size()));
+ select1s_.push_back(static_cast<UInt32>(num_bits));
select1s_.shrink();
}
}
diff --git a/contrib/python/marisa-trie/py3/ya.make b/contrib/python/marisa-trie/py3/ya.make
index b226d84e135..c1ad602db2c 100644
--- a/contrib/python/marisa-trie/py3/ya.make
+++ b/contrib/python/marisa-trie/py3/ya.make
@@ -4,14 +4,10 @@ PY3_LIBRARY()
PROVIDES(MARISA-TRIE)
-VERSION(1.2.1)
+VERSION(1.3.0)
LICENSE(MIT)
-PEERDIR(
- contrib/python/setuptools
-)
-
ADDINCL(
contrib/python/marisa-trie/py3/marisa-trie/include
contrib/python/marisa-trie/py3/marisa-trie/lib
@@ -45,6 +41,8 @@ RESOURCE_FILES(
PREFIX contrib/python/marisa-trie/py3/
.dist-info/METADATA
.dist-info/top_level.txt
+ marisa-trie/AUTHORS
+ marisa-trie/COPYING.md
)
END()
diff --git a/contrib/restricted/expected-lite/.yandex_meta/__init__.py b/contrib/restricted/expected-lite/.yandex_meta/__init__.py
new file mode 100644
index 00000000000..05dc09934b3
--- /dev/null
+++ b/contrib/restricted/expected-lite/.yandex_meta/__init__.py
@@ -0,0 +1,19 @@
+from devtools.yamaker.modules import Library
+from devtools.yamaker.project import NixSourceProject
+
+
+def post_install(self):
+ self.yamakes["."] = self.module(Library)
+
+
+expected_lite = NixSourceProject(
+ arcdir="contrib/restricted/expected-lite",
+ owners=["g:cpp-contrib"],
+ nixattr="expected-lite",
+ copy_sources=["include/**"],
+ disable_includes=[
+ "expected",
+ "nonstd/expected.tweak.hpp",
+ ],
+ post_install=post_install,
+)
diff --git a/contrib/restricted/expected-lite/.yandex_meta/default.nix b/contrib/restricted/expected-lite/.yandex_meta/default.nix
new file mode 100644
index 00000000000..21a49cd636a
--- /dev/null
+++ b/contrib/restricted/expected-lite/.yandex_meta/default.nix
@@ -0,0 +1,15 @@
+self: super: with self; {
+ expected-lite = stdenv.mkDerivation rec {
+ pname = "expected-lite";
+ version = "0.9.0";
+
+ src = fetchFromGitHub {
+ owner = "martinmoene";
+ repo = "expected-lite";
+ rev = "v${version}";
+ hash = "sha256-LRXxUaDQT5q9dXK2uYFvCgEuGWEHKr95lfdGTGjke0g=";
+ };
+
+ nativeBuildInputs = [ cmake ];
+ };
+}