From 88445e9e98a7e5bbfc83eb6c4d7fcb283417319e Mon Sep 17 00:00:00 2001 From: Olaf van der Spek Date: Sun, 26 Mar 2017 13:20:32 +0200 Subject: Don't shorten without need --- toolsrc/src/vcpkglib_helpers.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toolsrc/src/vcpkglib_helpers.cpp b/toolsrc/src/vcpkglib_helpers.cpp index 1730be374..78dd449f7 100644 --- a/toolsrc/src/vcpkglib_helpers.cpp +++ b/toolsrc/src/vcpkglib_helpers.cpp @@ -47,9 +47,9 @@ namespace vcpkg::details std::string shorten_description(const std::string& desc) { - auto simple_desc = std::regex_replace(desc.substr(0, 49), std::regex("\\n( |\\t)?"), ""); - if (desc.size() > 49) - simple_desc.append("..."); - return simple_desc; + auto simple_desc = std::regex_replace(desc, std::regex("\\n( |\\t)?"), ""); + return simple_desc.size() <= 52 + ? simple_desc + : simple_desc.substr(0, 49) + "..."; } } -- cgit v1.2.3 From bfb3ef841b339b969708f52762efc38f6f799a50 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 27 Mar 2017 02:09:39 -0400 Subject: add pybind11 port --- ports/pybind11/CONTROL | 3 +++ ports/pybind11/portfile.cmake | 45 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 ports/pybind11/CONTROL create mode 100644 ports/pybind11/portfile.cmake diff --git a/ports/pybind11/CONTROL b/ports/pybind11/CONTROL new file mode 100644 index 000000000..536647265 --- /dev/null +++ b/ports/pybind11/CONTROL @@ -0,0 +1,3 @@ +Source: pybind11 +Version: 2.0.1 +Description: pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code. \ No newline at end of file diff --git a/ports/pybind11/portfile.cmake b/ports/pybind11/portfile.cmake new file mode 100644 index 000000000..47e195a22 --- /dev/null +++ b/ports/pybind11/portfile.cmake @@ -0,0 +1,45 @@ +include(vcpkg_common_functions) + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pybind11-2.0.1) + +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/pybind/pybind11/archive/v2.0.1.tar.gz" + FILENAME "pybind11-2.0.1.tar.gz" + SHA512 c156d01321b79eaac7992f431b30a9f4fb06e92909bf02e76a45e2d9329e7949dad686ee42a49c293214aec2a79eb400fa3373d2ba4876271895822096b50ff4 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +# link the MSVC runtime statically if set. +if(VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(CRUNTIME /MD) +else() + set(CRUNTIME /MT) +endif() + +#STREQUAL empty here means the enviroment variable is not defined. +if(NOT $ENV{PYTHON} STREQUAL "") + set(PYTHON_VER $ENV{PYTHON}) +else() + message(FATAL_ERROR "You must set the PYTHON environment variable, eg. set PYTHON=3.5 or export PYTHON=3.5") +endif() + +if(NOT $ENV{CPP} STREQUAL "") + set(CPP_STD $ENV{CPP}) +else() + message(FATAL_ERROR "You must set the CPP environment variable, eg. set CPP=11 or export CPP=11.") +endif() +message(STATUS "Using C++${CPP_STD} and Python ${PYTHON_VER}") +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DPYBIND11_PYTHON_VERSION=${PYTHON_VER} + -DPYBIND11_CPP_STANDARD=${CPP_STD} +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/) + + +# copy license +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/pybind11/copyright) \ No newline at end of file -- cgit v1.2.3 From 0723e5268d37d4c9632c4b0fa99504216cfec38e Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 27 Mar 2017 02:21:48 -0400 Subject: update pybind11 to 2.1.0 --- ports/pybind11/CONTROL | 2 +- ports/pybind11/portfile.cmake | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/pybind11/CONTROL b/ports/pybind11/CONTROL index 536647265..a51fd173c 100644 --- a/ports/pybind11/CONTROL +++ b/ports/pybind11/CONTROL @@ -1,3 +1,3 @@ Source: pybind11 -Version: 2.0.1 +Version: 2.1.0 Description: pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code. \ No newline at end of file diff --git a/ports/pybind11/portfile.cmake b/ports/pybind11/portfile.cmake index 47e195a22..5dd99fddf 100644 --- a/ports/pybind11/portfile.cmake +++ b/ports/pybind11/portfile.cmake @@ -3,9 +3,9 @@ include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pybind11-2.0.1) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/pybind/pybind11/archive/v2.0.1.tar.gz" - FILENAME "pybind11-2.0.1.tar.gz" - SHA512 c156d01321b79eaac7992f431b30a9f4fb06e92909bf02e76a45e2d9329e7949dad686ee42a49c293214aec2a79eb400fa3373d2ba4876271895822096b50ff4 + URLS "https://github.com/pybind/pybind11/archive/v2.1.0.tar.gz" + FILENAME "pybind11-2.1.0.tar.gz" + SHA512 2f74dcd2b82d8e41da7db36351284fe04511038bec66bdde820da9c0fce92f6d2c5aeb2e48264058a91a775a1a6a99bc757d26ebf001de3df4183d700d46efa1 ) vcpkg_extract_source_archive(${ARCHIVE}) -- cgit v1.2.3 From 7a703e7a985589993518f72830f96738175e4d53 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 27 Mar 2017 02:36:12 -0400 Subject: remove unused options --- ports/pybind11/portfile.cmake | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/ports/pybind11/portfile.cmake b/ports/pybind11/portfile.cmake index 5dd99fddf..d899aa31e 100644 --- a/ports/pybind11/portfile.cmake +++ b/ports/pybind11/portfile.cmake @@ -16,24 +16,9 @@ else() set(CRUNTIME /MT) endif() -#STREQUAL empty here means the enviroment variable is not defined. -if(NOT $ENV{PYTHON} STREQUAL "") - set(PYTHON_VER $ENV{PYTHON}) -else() - message(FATAL_ERROR "You must set the PYTHON environment variable, eg. set PYTHON=3.5 or export PYTHON=3.5") -endif() - -if(NOT $ENV{CPP} STREQUAL "") - set(CPP_STD $ENV{CPP}) -else() - message(FATAL_ERROR "You must set the CPP environment variable, eg. set CPP=11 or export CPP=11.") -endif() -message(STATUS "Using C++${CPP_STD} and Python ${PYTHON_VER}") vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} OPTIONS - -DPYBIND11_PYTHON_VERSION=${PYTHON_VER} - -DPYBIND11_CPP_STANDARD=${CPP_STD} ) vcpkg_install_cmake() -- cgit v1.2.3 From 4990c31f7690131cea5fee7bcd2dea94a203606d Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 27 Mar 2017 03:21:22 -0400 Subject: fix sourcepath pybind11 2.1.0 --- ports/pybind11/portfile.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/pybind11/portfile.cmake b/ports/pybind11/portfile.cmake index d899aa31e..892b260b2 100644 --- a/ports/pybind11/portfile.cmake +++ b/ports/pybind11/portfile.cmake @@ -1,6 +1,6 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pybind11-2.0.1) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/pybind11-2.1.0) vcpkg_download_distfile(ARCHIVE URLS "https://github.com/pybind/pybind11/archive/v2.1.0.tar.gz" -- cgit v1.2.3 From d2bab3c370fca9fa5216d97495810faaeeaebc2d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 24 Mar 2017 10:46:49 -0700 Subject: Rework Paragraph parsing error handling. Add single paragraph functions --- toolsrc/include/Paragraphs.h | 6 ++-- toolsrc/include/paragraph_parse_result.h | 35 +++++++++++++++++++ toolsrc/src/Paragraphs.cpp | 57 +++++++++++++++++++------------ toolsrc/src/PostBuildLint_BuildInfo.cpp | 8 ++--- toolsrc/src/commands_cache.cpp | 19 +++-------- toolsrc/src/commands_import.cpp | 6 ++-- toolsrc/src/paragraph_parse_result.cpp | 45 ++++++++++++++++++++++++ toolsrc/src/tests_paragraph.cpp | 24 ++++++------- toolsrc/src/vcpkg.cpp | 4 +-- toolsrc/src/vcpkglib.cpp | 6 ++-- toolsrc/vcpkglib/vcpkglib.vcxproj | 2 ++ toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 6 ++++ 12 files changed, 153 insertions(+), 65 deletions(-) create mode 100644 toolsrc/include/paragraph_parse_result.h create mode 100644 toolsrc/src/paragraph_parse_result.cpp diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/Paragraphs.h index 79b66a67f..74f8218ca 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/Paragraphs.h @@ -8,8 +8,10 @@ namespace vcpkg::Paragraphs { - std::vector> get_paragraphs(const fs::path& control_path); - std::vector> parse_paragraphs(const std::string& str); + expected> get_single_paragraph(const fs::path& control_path); + expected>> get_paragraphs(const fs::path& control_path); + expected> parse_single_paragraph(const std::string& str); + expected>> parse_paragraphs(const std::string& str); expected try_load_port(const fs::path& control_path); diff --git a/toolsrc/include/paragraph_parse_result.h b/toolsrc/include/paragraph_parse_result.h new file mode 100644 index 000000000..47f20c08e --- /dev/null +++ b/toolsrc/include/paragraph_parse_result.h @@ -0,0 +1,35 @@ +#pragma once +#include + +namespace vcpkg +{ + enum class paragraph_parse_result + { + SUCCESS = 0, + EXPECTED_ONE_PARAGRAPH + }; + + struct paragraph_parse_result_category_impl final : std::error_category + { + virtual const char* name() const noexcept override; + + virtual std::string message(int ev) const noexcept override; + }; + + const std::error_category& paragraph_parse_result_category(); + + std::error_code make_error_code(paragraph_parse_result e); + + paragraph_parse_result to_paragraph_parse_result(int i); + + paragraph_parse_result to_paragraph_parse_result(std::error_code ec); +} + +// Enable implicit conversion to std::error_code +namespace std +{ + template <> + struct is_error_code_enum : ::std::true_type + { + }; +} diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp index f1505698c..2bdddb58c 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/Paragraphs.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include "Paragraphs.h" #include "vcpkg_Files.h" +#include "paragraph_parse_result.h" namespace vcpkg::Paragraphs { @@ -150,7 +151,18 @@ namespace vcpkg::Paragraphs } }; - std::vector> get_paragraphs(const fs::path& control_path) + expected> get_single_paragraph(const fs::path& control_path) + { + const expected contents = Files::read_contents(control_path); + if (auto spgh = contents.get()) + { + return parse_single_paragraph(*spgh); + } + + return contents.error_code(); + } + + expected>> get_paragraphs(const fs::path& control_path) { const expected contents = Files::read_contents(control_path); if (auto spgh = contents.get()) @@ -158,44 +170,47 @@ namespace vcpkg::Paragraphs return parse_paragraphs(*spgh); } - Checks::exit_with_message(VCPKG_LINE_INFO, "Error while reading %s: %s", control_path.generic_string(), contents.error_code().message()); + return contents.error_code(); + } + + expected> parse_single_paragraph(const std::string& str) + { + const std::vector> p = Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); + + if (p.size() == 1) + { + return p.at(0); + } + + return std::error_code(paragraph_parse_result::EXPECTED_ONE_PARAGRAPH); } - std::vector> parse_paragraphs(const std::string& str) + expected>> parse_paragraphs(const std::string& str) { return Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); } expected try_load_port(const fs::path& path) { - try + expected> pghs = get_single_paragraph(path / "CONTROL"); + if (auto p = pghs.get()) { - auto pghs = get_paragraphs(path / "CONTROL"); - Checks::check_exit(VCPKG_LINE_INFO, pghs.size() == 1, "Invalid control file at %s\\CONTROL", path.string()); - return SourceParagraph(pghs[0]); + return SourceParagraph(*p); } - catch (std::runtime_error const&) {} - return std::errc::no_such_file_or_directory; + return pghs.error_code(); } expected try_load_cached_package(const vcpkg_paths& paths, const package_spec& spec) { - const fs::path path = paths.package_dir(spec) / "CONTROL"; + expected> pghs = get_single_paragraph(paths.package_dir(spec) / "CONTROL"); - auto control_contents_maybe = Files::read_contents(path); - if (auto control_contents = control_contents_maybe.get()) + if (auto p = pghs.get()) { - std::vector> pghs; - try - { - pghs = parse_paragraphs(*control_contents); - } - catch (std::runtime_error) {} - Checks::check_exit(VCPKG_LINE_INFO, pghs.size() == 1, "Invalid control file at %s", path.string()); - return BinaryParagraph(pghs[0]); + return BinaryParagraph(*p); } - return control_contents_maybe.error_code(); + + return pghs.error_code(); } std::vector load_all_ports(const fs::path& ports_dir) diff --git a/toolsrc/src/PostBuildLint_BuildInfo.cpp b/toolsrc/src/PostBuildLint_BuildInfo.cpp index 5b475322a..7b7751e66 100644 --- a/toolsrc/src/PostBuildLint_BuildInfo.cpp +++ b/toolsrc/src/PostBuildLint_BuildInfo.cpp @@ -39,10 +39,8 @@ namespace vcpkg::PostBuildLint BuildInfo read_build_info(const fs::path& filepath) { - const std::vector> pghs = Paragraphs::get_paragraphs(filepath); - Checks::check_exit(VCPKG_LINE_INFO, pghs.size() == 1, "Invalid BUILD_INFO file for package"); - - return BuildInfo::create(pghs[0]); + const expected> pghs = Paragraphs::get_single_paragraph(filepath); + Checks::check_exit(VCPKG_LINE_INFO, pghs.get() != nullptr, "Invalid BUILD_INFO file for package"); + return BuildInfo::create(*pghs.get()); } - } diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/commands_cache.cpp index 417799abb..6504c8c4d 100644 --- a/toolsrc/src/commands_cache.cpp +++ b/toolsrc/src/commands_cache.cpp @@ -13,22 +13,11 @@ namespace vcpkg::Commands::Cache for (auto it = fs::directory_iterator(paths.packages); it != fs::directory_iterator(); ++it) { const fs::path& path = it->path(); - - try - { - auto file_contents = Files::read_contents(path / "CONTROL"); - if (auto text = file_contents.get()) - { - auto pghs = Paragraphs::parse_paragraphs(*text); - if (pghs.size() != 1) - continue; - - const BinaryParagraph binary_paragraph = BinaryParagraph(pghs[0]); - output.push_back(binary_paragraph); - } - } - catch (std::runtime_error const&) + const expected> pghs = Paragraphs::get_single_paragraph(path / "CONTROL"); + if (auto p = pghs.get()) { + const BinaryParagraph binary_paragraph = BinaryParagraph(*p); + output.push_back(binary_paragraph); } } diff --git a/toolsrc/src/commands_import.cpp b/toolsrc/src/commands_import.cpp index 69710765f..6be5c2fe1 100644 --- a/toolsrc/src/commands_import.cpp +++ b/toolsrc/src/commands_import.cpp @@ -72,11 +72,11 @@ namespace vcpkg::Commands::Import const fs::path include_directory(args.command_arguments[1]); const fs::path project_directory(args.command_arguments[2]); - auto pghs = Paragraphs::get_paragraphs(control_file_path); - Checks::check_exit(VCPKG_LINE_INFO, pghs.size() == 1, "Invalid control file %s for package", control_file_path.generic_string()); + const expected> pghs = Paragraphs::get_single_paragraph(control_file_path); + Checks::check_exit(VCPKG_LINE_INFO, pghs.get() != nullptr, "Invalid control file %s for package", control_file_path.generic_string()); StatusParagraph spgh; - spgh.package = BinaryParagraph(pghs[0]); + spgh.package = BinaryParagraph(*pghs.get()); auto& control_file_data = spgh.package; do_import(paths, include_directory, project_directory, control_file_data); diff --git a/toolsrc/src/paragraph_parse_result.cpp b/toolsrc/src/paragraph_parse_result.cpp new file mode 100644 index 000000000..4715f7a16 --- /dev/null +++ b/toolsrc/src/paragraph_parse_result.cpp @@ -0,0 +1,45 @@ +#include "pch.h" +#include "vcpkg_Checks.h" +#include "paragraph_parse_result.h" + +namespace vcpkg +{ + const char* paragraph_parse_result_category_impl::name() const noexcept + { + return "paragraph_parse_result"; + } + + std::string paragraph_parse_result_category_impl::message(int ev) const noexcept + { + switch (static_cast(ev)) + { + case paragraph_parse_result::SUCCESS: + return "OK"; + case paragraph_parse_result::EXPECTED_ONE_PARAGRAPH: + return "There should be exactly one paragraph"; + default: + Checks::unreachable(VCPKG_LINE_INFO); + } + } + + const std::error_category& paragraph_parse_result_category() + { + static paragraph_parse_result_category_impl instance; + return instance; + } + + std::error_code make_error_code(paragraph_parse_result e) + { + return std::error_code(static_cast(e), paragraph_parse_result_category()); + } + + paragraph_parse_result to_paragraph_parse_result(int i) + { + return static_cast(i); + } + + paragraph_parse_result to_paragraph_parse_result(std::error_code ec) + { + return to_paragraph_parse_result(ec.value()); + } +} diff --git a/toolsrc/src/tests_paragraph.cpp b/toolsrc/src/tests_paragraph.cpp index fb20eee82..b5e630aca 100644 --- a/toolsrc/src/tests_paragraph.cpp +++ b/toolsrc/src/tests_paragraph.cpp @@ -153,14 +153,14 @@ namespace UnitTest1 TEST_METHOD(parse_paragraphs_empty) { const char* str = ""; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).get_or_throw(VCPKG_LINE_INFO); Assert::IsTrue(pghs.empty()); } TEST_METHOD(parse_paragraphs_one_field) { const char* str = "f1: v1"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(1), pghs.size()); Assert::AreEqual(size_t(1), pghs[0].size()); Assert::AreEqual("v1", pghs[0]["f1"].c_str()); @@ -171,7 +171,7 @@ namespace UnitTest1 const char* str = "f1: v1\n" "f2: v2"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(1), pghs.size()); Assert::AreEqual(size_t(2), pghs[0].size()); Assert::AreEqual("v1", pghs[0]["f1"].c_str()); @@ -186,7 +186,7 @@ namespace UnitTest1 "\n" "f3: v3\n" "f4: v4"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(2), pghs.size()); Assert::AreEqual(size_t(2), pghs[0].size()); Assert::AreEqual("v1", pghs[0]["f1"].c_str()); @@ -204,7 +204,7 @@ namespace UnitTest1 "F:\n" "0:\n" "F-2:\n"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(1), pghs.size()); Assert::AreEqual(size_t(5), pghs[0].size()); } @@ -218,7 +218,7 @@ namespace UnitTest1 "\n" "f3: v3\n" "f4: v4"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(2), pghs.size()); } @@ -227,7 +227,7 @@ namespace UnitTest1 const char* str = "f1:\n" "f2: "; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(1), pghs.size()); Assert::AreEqual(size_t(2), pghs[0].size()); Assert::AreEqual("", pghs[0]["f1"].c_str()); @@ -243,7 +243,7 @@ namespace UnitTest1 "f2:\r\n" " f2\r\n" " continue\r\n"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(1), pghs.size()); Assert::AreEqual("simple\n f1", pghs[0]["f1"].c_str()); Assert::AreEqual("\n f2\n continue", pghs[0]["f2"].c_str()); @@ -257,7 +257,7 @@ namespace UnitTest1 "\r\n" "f3: v3\r\n" "f4: v4"; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(str); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(str).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(2), pghs.size()); Assert::AreEqual(size_t(2), pghs[0].size()); Assert::AreEqual("v1", pghs[0]["f1"].c_str()); @@ -277,7 +277,7 @@ namespace UnitTest1 {"Multi-Arch", "same"}, }); ss << pgh; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss.str()); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss.str()).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(1), pghs.size()); Assert::AreEqual(size_t(4), pghs[0].size()); Assert::AreEqual("zlib", pghs[0]["Package"].c_str()); @@ -299,7 +299,7 @@ namespace UnitTest1 {"Multi-Arch", "same"}, }); ss << pgh; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss.str()); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss.str()).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(1), pghs.size()); Assert::AreEqual(size_t(7), pghs[0].size()); Assert::AreEqual("zlib", pghs[0]["Package"].c_str()); @@ -321,7 +321,7 @@ namespace UnitTest1 {"Depends", "a, b, c"}, }); ss << pgh; - auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss.str()); + auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss.str()).get_or_throw(VCPKG_LINE_INFO); Assert::AreEqual(size_t(1), pghs.size()); Assert::AreEqual("a, b, c", pghs[0]["Depends"].c_str()); } diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index f6acf07a0..4caeb93e1 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -111,10 +111,8 @@ static void loadConfig() try { - std::string config_contents = Files::read_contents(localappdata / "vcpkg" / "config").get_or_throw(VCPKG_LINE_INFO); - + auto pghs = Paragraphs::get_paragraphs(localappdata / "vcpkg" / "config").get_or_throw(VCPKG_LINE_INFO); std::unordered_map keys; - auto pghs = Paragraphs::parse_paragraphs(config_contents); if (pghs.size() > 0) keys = pghs[0]; diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkglib.cpp index 932502d2d..204e1c0d7 100644 --- a/toolsrc/src/vcpkglib.cpp +++ b/toolsrc/src/vcpkglib.cpp @@ -22,8 +22,7 @@ namespace vcpkg fs::rename(vcpkg_dir_status_file_old, vcpkg_dir_status_file); } - auto text = Files::read_contents(vcpkg_dir_status_file).get_or_throw(VCPKG_LINE_INFO); - auto pghs = Paragraphs::parse_paragraphs(text); + auto pghs = Paragraphs::get_paragraphs(vcpkg_dir_status_file).get_or_throw(VCPKG_LINE_INFO); std::vector> status_pghs; for (auto&& p : pghs) @@ -65,8 +64,7 @@ namespace vcpkg if (b->path().filename() == "incomplete") continue; - auto text = Files::read_contents(b->path()).get_or_throw(VCPKG_LINE_INFO); - auto pghs = Paragraphs::parse_paragraphs(text); + auto pghs = Paragraphs::get_paragraphs(b->path()).get_or_throw(VCPKG_LINE_INFO); for (auto&& p : pghs) { current_status_db.insert(std::make_unique(p)); diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 237af6543..9fb4641b9 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -139,6 +139,7 @@ + @@ -183,6 +184,7 @@ + diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 60eaa167a..3474e221b 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -174,6 +174,9 @@ Source Files + + Source Files + @@ -302,5 +305,8 @@ Header Files + + Header Files + \ No newline at end of file -- cgit v1.2.3 From 125d98cb0848f490c11be5c62e1a87eded67dd7e Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 27 Mar 2017 16:32:51 -0700 Subject: [vcpkg-lint] Improve diagnostics as identified in #857 --- toolsrc/src/PostBuildLint.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 5f271d84f..65e0683f2 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -109,7 +109,8 @@ namespace vcpkg::PostBuildLint if (fs::exists(debug_share) && !fs::is_empty(debug_share)) { - System::println(System::color::warning, "No files should be present in /debug/share"); + System::println(System::color::warning, "/debug/share should not exist. Please reorganize any important files, then use\n" + " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)"); return lint_status::ERROR_DETECTED; } -- cgit v1.2.3 From 2aff607cbf0e946773a1804d630655209439930c Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 27 Mar 2017 17:25:38 -0700 Subject: [pybind11] Disable building tests to remove pytest dependency. --- ports/pybind11/portfile.cmake | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/ports/pybind11/portfile.cmake b/ports/pybind11/portfile.cmake index 892b260b2..933efbd19 100644 --- a/ports/pybind11/portfile.cmake +++ b/ports/pybind11/portfile.cmake @@ -9,22 +9,14 @@ vcpkg_download_distfile(ARCHIVE ) vcpkg_extract_source_archive(${ARCHIVE}) -# link the MSVC runtime statically if set. -if(VCPKG_CRT_LINKAGE STREQUAL dynamic) - set(CRUNTIME /MD) -else() - set(CRUNTIME /MT) -endif() - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - OPTIONS + OPTIONS -DPYBIND11_TEST=OFF ) vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/) - # copy license file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/pybind11/copyright) \ No newline at end of file -- cgit v1.2.3