Skip to content

Commit

Permalink
Add regex patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Juan Oxoby committed Oct 17, 2020
1 parent a9974d7 commit 3b11e57
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipes/ignition-math/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ sources:
"6.6.0":
url: "https://github.com/ignitionrobotics/ign-math/archive/ignition-math6_6.6.0.zip"
sha256: "7c29a8fa49edba1cff8e6a6194ae74942a103eefc3504b3afb63de54d7a510e9"
patches:
"6.6.0":
- base_path: "source_subfolder"
patch_file: "patches/0001-Define-time_regex-locally.patch"
3 changes: 3 additions & 0 deletions recipes/ignition-math/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class IgnitionMathConan(ConanFile):
options = {"shared": [True, False]}
default_options = {"shared": False}
generators = "cmake_find_package_multi"
exports_sources = ["patches/**"]

_cmake = None

Expand Down Expand Up @@ -77,6 +78,8 @@ def _configure_cmake(self):
return self._cmake

def build(self):
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
self._install_ign_cmake()
self._configure_cmake()
cmake = self._configure_cmake()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From 24a9b3284fcbf05cfec09d9cbd4de4d9977c8318 Mon Sep 17 00:00:00 2001
From: Juan Oxoby <juan@vicarious.com>
Date: Fri, 16 Oct 2020 21:28:37 -0700
Subject: [PATCH] Define time_regex locally

---
include/ignition/math/Helpers.hh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/ignition/math/Helpers.hh b/include/ignition/math/Helpers.hh
index 2dd5cc6..bd4d35f 100644
--- a/include/ignition/math/Helpers.hh
+++ b/include/ignition/math/Helpers.hh
@@ -870,7 +870,7 @@ namespace ignition
// The following regex takes a time string in the general format of
// "dd hh:mm:ss.nnn" where n is milliseconds, if just one number is
// provided, it is assumed to be seconds
- static const std::regex time_regex(
+ static const char* time_regex_str =
"^([0-9]+ ){0,1}" // day:
// Any positive integer

@@ -887,7 +887,7 @@ namespace ignition
// 0 - 9
// 00 - 59

- "(\\.[0-9]{1,3}){0,1})$"); // millisecond:
+ "(\\.[0-9]{1,3}){0,1})$"; // millisecond:
// .0 - .9
// .00 - .99
// .000 - 0.999
@@ -907,6 +907,7 @@ namespace ignition
uint64_t & numberMinutes, uint64_t & numberSeconds,
uint64_t & numberMilliseconds)
{
+ static const std::regex time_regex(time_regex_str);
std::smatch matches;

// `matches` should always be a size of 6 as there are 6 matching
--
2.17.1

0 comments on commit 3b11e57

Please sign in to comment.