Skip to content

Commit 7c65442

Browse files
squash! Don't require Doxygen from Conan if there's a system install.
checkpoint
1 parent 0a75db6 commit 7c65442

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

cmake/conanfile.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@ bin, * -> tools
4040

4141
[tool_requires]
4242
cmake/3.26.4
43-

cmake/setup.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,20 @@ else()
3535
#How incredibly obnoxious is it that conan 2 dropped support for these envs?
3636
file(WRITE "${conan_home}/global.conf" core.net.http:timeout=$ENV{CONAN_REQUEST_TIMEOUT})
3737
endif()
38+
file(COPY_FILE
39+
"${CMAKE_CURRENT_LIST_DIR}/conanfile.txt"
40+
"${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt"
41+
)
3842
find_package(Doxygen)
3943
if (NOT DOXYGEN_FOUND)
44+
message(WARNING "Will attempt to get doxygen from Conan, which doesn't work on some systems like Github's ubuntu-latest runner.")
4045
file(APPEND
41-
"${CMAKE_CURRENT_LIST_DIR}/conanfile.txt"
46+
"${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt"
4247
doxygen/1.9.4
4348
)
4449
endif()
4550
execute_process(
46-
COMMAND conan install ${CMAKE_CURRENT_LIST_DIR} --output-folder=${CMAKE_CURRENT_BINARY_DIR} --build=missing --settings build_type=${CMAKE_BUILD_TYPE} --generator CMakeDeps
51+
COMMAND conan install ${CMAKE_CURRENT_BINARY_DIR} --output-folder=${CMAKE_CURRENT_BINARY_DIR} --build=missing --settings build_type=${CMAKE_BUILD_TYPE} --generator CMakeDeps
4752
COMMAND_ERROR_IS_FATAL ANY
4853
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
4954
)

library/conanfile.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from conan import ConanFile
22
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
3+
from shutil import which
34
import sys
45
from os.path import dirname, join, realpath
56
sys.path.append(realpath(join(dirname(__file__), '..', 'cmake')))
@@ -22,7 +23,6 @@ class IpfsChromium(ConanFile):
2223
default_options = {"boost/*:header_only": True}
2324
tool_requires = [
2425
'cmake/3.22.6',
25-
'doxygen/1.9.1',
2626
'ninja/1.11.1',
2727
_PB,
2828
]
@@ -40,4 +40,9 @@ def build(self):
4040
"INSIDE_CONAN": True
4141
})
4242
cmake.build()
43+
44+
45+
def build_requirements(self):
46+
if not which("doxygen"):
47+
self.tool_requires("doxygen/1.9.4")
4348
# gperf doxygen ccache lcov

library/src/ipfs_client/gateways.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ std::vector<std::pair<std::string, int>> ipfs::Gateways::DefaultGateways() {
7373
std::vector<std::pair<std::string, int>> result;
7474
std::string gw;
7575
while (user_override >> gw) {
76+
if ( gw.empty() ) {
77+
continue;
78+
}
79+
if ( gw.back() != '/' ) {
80+
gw.push_back('/');
81+
}
7682
result.emplace_back( gw, 0 );
7783
}
7884
auto N = static_cast<int>(result.size());

library/src/ipfs_client/gateways_unittest.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,14 @@ TEST(GatewaysTest, DefaultListMeetsBasicGuidelines) {
1515
EXPECT_LE(dg.at(i).second, dg.at(i - 1).second);
1616
}
1717
}
18+
19+
TEST(GatewaysTest, OverriddenListEndsEntriesInSlash) {
20+
::putenv("IPFS_GATEWAY= a b c d 1 : http://chomp:8080");
21+
auto dg = ipfs::Gateways::DefaultGateways();
22+
EXPECT_EQ(dg.size(), 7U);
23+
EXPECT_EQ(dg.at(0).first, "a/");
24+
for (auto i = 1U; i < dg.size(); ++i) {
25+
EXPECT_EQ(dg.at(i).first.back(), '/');
26+
EXPECT_LE(dg.at(i).second, dg.at(i - 1).second);
27+
}
28+
}

0 commit comments

Comments
 (0)