Skip to content

Added XEUS_SEARCH_PATH support in xeus-cpp #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kr-2003
Copy link
Contributor

@kr-2003 kr-2003 commented Feb 20, 2025

Description

Added interpreter::init_includes function and added XEUS_SEARCH_PATH in CMakeLists.txt.

Key Changes

  1. Parsing the XEUS_SEARCH_PATH environment variable in interpreter::init_includes.
  2. Updates to CMakeLists.txt and /test/CMakeLists.txt for joining include directories and testing respectively.

Fixes #175

Type of change

  • New feature

@codecov-commenter
Copy link

codecov-commenter commented Feb 20, 2025

Codecov Report

Attention: Patch coverage is 36.36364% with 7 lines in your changes missing coverage. Please review.

Project coverage is 80.22%. Comparing base (f054951) to head (5aaddc5).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/xinterpreter.cpp 36.36% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #257      +/-   ##
==========================================
- Coverage   80.72%   80.22%   -0.50%     
==========================================
  Files          19       19              
  Lines         970      981      +11     
  Branches       93       96       +3     
==========================================
+ Hits          783      787       +4     
- Misses        187      194       +7     
Files with missing lines Coverage Δ
src/xinterpreter.cpp 88.08% <36.36%> (-3.13%) ⬇️
Files with missing lines Coverage Δ
src/xinterpreter.cpp 88.08% <36.36%> (-3.13%) ⬇️

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

@@ -12,6 +12,7 @@
#define XEUS_CPP_INTERPRETER_HPP

#include <memory>
#include <sstream>
#include <streambuf>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header sstream is not used directly [misc-include-cleaner]

Suggested change
#include <streambuf>
#include <streambuf>

@@ -356,6 +357,20 @@ __get_cxx_version ()
publish_stream("stderr", s);
}

void interpreter::init_includes()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'init_includes' can be made static [readability-convert-member-functions-to-static]

include/xeus-cpp/xinterpreter.hpp:74:

-         void init_includes();
+         static void init_includes();

@@ -356,6 +357,20 @@
publish_stream("stderr", s);
}

void interpreter::init_includes()
{
Cpp::AddIncludePath((xeus::prefix_path() + "/include/").c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "Cpp::AddIncludePath" is directly included [misc-include-cleaner]

        Cpp::AddIncludePath((xeus::prefix_path() + "/include/").c_str());
             ^

void interpreter::init_includes()
{
Cpp::AddIncludePath((xeus::prefix_path() + "/include/").c_str());
if (const char* paths = std::getenv("XEUS_SEARCH_PATH")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::getenv" is directly included [misc-include-cleaner]

src/xinterpreter.cpp:19:

- #ifndef EMSCRIPTEN
+ #include <cstdlib>
+ #ifndef EMSCRIPTEN

{
Cpp::AddIncludePath((xeus::prefix_path() + "/include/").c_str());
if (const char* paths = std::getenv("XEUS_SEARCH_PATH")) {
std::istringstream stream(paths);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::istringstream" is directly included [misc-include-cleaner]

src/xinterpreter.cpp:19:

- #ifndef EMSCRIPTEN
+ #include <sstream>
+ #ifndef EMSCRIPTEN

std::string path;
char delimiter = (std::string(paths).find(';') != std::string::npos) ? ';' : ':';

while (std::getline(stream, path, delimiter))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "std::getline" is directly included [misc-include-cleaner]

            while (std::getline(stream, path, delimiter))
                        ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust include path search according to dependencies
2 participants