-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add pipes/1.0.0 * Add line breaks at end of files * Minimum c++ standard version * Fix min std version * Apply suggestions * Fix not importing errors * Revert to .format() from f-string
- Loading branch information
1 parent
318b815
commit ddd49bf
Showing
6 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"1.0.0": | ||
url: "https://github.com/joboccara/pipes/archive/v1.0.0.tar.gz" | ||
sha256: "f1d477e2627701e34a966be72530e3a243333632f09fb89df27e91f1c55fad0a" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from conans import ConanFile, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import os | ||
|
||
class PipesConan(ConanFile): | ||
name = "pipes" | ||
description = "Pipelines for expressive code on collections in C++" | ||
license = "MIT" | ||
topics = ("pipes", "functional-programming") | ||
homepage = "https://github.com/joboccara/pipes" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
settings = "compiler" | ||
no_copy_source = True | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _minimum_cpp_standard(self): | ||
return 14 | ||
|
||
@property | ||
def _minimum_compilers_version(self): | ||
return { | ||
"Visual Studio": "15", | ||
"gcc": "5", | ||
"clang": "3.4", | ||
"apple-clang": "5.1", | ||
} | ||
|
||
def configure(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
tools.check_min_cppstd(self, self._minimum_cpp_standard) | ||
min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) | ||
if not min_version: | ||
self.output.warn("{} recipe lacks information about the {} compiler support.".format( | ||
self.name, self.settings.compiler)) | ||
else: | ||
if tools.Version(self.settings.compiler.version) < min_version: | ||
raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( | ||
self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) | ||
|
||
def package_id(self): | ||
self.info.header_only() | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename("pipes-{}".format(self.version), self._source_subfolder) | ||
|
||
def package(self): | ||
self.copy("LICENSE", dst="licenses", src=self._source_subfolder) | ||
self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include"), keep_path=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(pipes REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} pipes::pipes) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
from conans import ConanFile, CMake, tools | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include <vector> | ||
#include <pipes/pipes.hpp> | ||
|
||
int main() { | ||
auto source = std::vector<int>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; | ||
auto destination = std::vector<int>{}; | ||
|
||
source >>= pipes::filter([](int i){ return i % 2 == 0; }) | ||
>>= pipes::transform([](int i){ return i * 2; }) | ||
>>= pipes::push_back(destination); | ||
|
||
auto expected = std::vector<int>{0, 4, 8, 12, 16}; | ||
bool success = destination == expected; | ||
|
||
return success ? 0 : 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"1.0.0": | ||
folder: all |