Skip to content
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

ipaddress: add recipe #23206

Merged

Conversation

VladimirShaleev
Copy link
Contributor

Specify library name and version: ipaddress/1.0.1

Hi! This is a new library for working with IP addresses and networks.

It is inspired by the well-thought-out API from the Python module for working with addresses and networks. Therefore, it is familiar and understandable for use by many programmers.

This library fills gaps in the implementation of other libraries: network parsing, working with stringize scope id, as well as network manipulation


@conan-center-bot

This comment has been minimized.

@RubenRBS RubenRBS self-assigned this Mar 21, 2024
@RubenRBS
Copy link
Member

Feel free to ping me once this is ready for review :) The recipe looks good as-is tho!

@VladimirShaleev
Copy link
Contributor Author

Hi! Thanks for the comment. I think PR is ready for review, I’ll change it to ready

@VladimirShaleev VladimirShaleev marked this pull request as ready for review March 22, 2024 11:21
@conan-center-bot

This comment has been minimized.

Comment on lines 25 to 26
options = {"exceptions": [True, False], "overload_std": [True, False], "ipv6_scope": [True, False], "ipv6_scope_max_length": ["ANY"]}
default_options = {"exceptions": True, "overload_std": True, "ipv6_scope": True, "ipv6_scope_max_length": 16}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
options = {"exceptions": [True, False], "overload_std": [True, False], "ipv6_scope": [True, False], "ipv6_scope_max_length": ["ANY"]}
default_options = {"exceptions": True, "overload_std": True, "ipv6_scope": True, "ipv6_scope_max_length": 16}
options = {
"exceptions": [True, False],
"overload_std": [True, False],
"ipv6_scope": [True, False],
"ipv6_scope_max_length": ["ANY"],
}
default_options = {
"exceptions": True,
"overload_std": True,
"ipv6_scope": True,
"ipv6_scope_max_length": 16,
}

For readability.

Comment on lines 38 to 45
if compiler == "gcc" and compiler_version < "7.5":
raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc < 7.5")
if compiler == "clang" and compiler_version < "6.0":
raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang < 6.0")
if compiler == "apple-clang" and compiler_version < "13.0":
raise ConanInvalidConfiguration(f"{self.ref} doesn't support Apple clang < 13.0")
if is_msvc(self) and compiler_version < "16":
raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC < 16")
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it will probably be better. I'll do it as in the template. But let me change the error text to more accurately convey the cause of the error.

If the new text is unacceptable, please respond to me. I will return the text from template.

Copy link
Contributor

@valgur valgur left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks! Just some cosmetic suggestions.

@VladimirShaleev
Copy link
Contributor Author

@valgur Thank you! Yes, these will be really good changes. Thanks for the feedback!

Thank you everyone for your help and work on my PR! Let me know if any other changes are needed

@conan-center-bot

This comment has been minimized.

Copy link
Member

@RubenRBS RubenRBS left a comment

Choose a reason for hiding this comment

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

Hi! Thanks a lot for taking the time to add the recipe and your patience while we were on Easter break

The recipe looks good overall, I just have a minor question with the test package :)


add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ipaddress::ipaddress)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
Copy link
Member

Choose a reason for hiding this comment

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

This is setting C++ 14, but the recipe indicates min to be C++ 11 (And the readme does too)

Suggested change
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)

To ensure we work for the min version :)

Unless there's a reason this is set to 14, any insight would be appreciated in that case!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, Rubén! I almost understand what needs to be done, but I want to clarify just in case:

target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)

does not configure compilation with C++11. It only checks that the compiler supports C++11 and higher. In reality, the compiling will be with the default version (usually 14 or 17).

In order to configure compilation with standard C++11, need to do the following:

set_target_properties(${PROJECT_NAME}
     PROPERTIES
         CXX_STANDARD 11
)

or

set_target_properties(${PROJECT_NAME}
     PROPERTIES
         CXX_STANDARD 11
         CXX_STANDARD_REQUIRED ON
         CXX_EXTENSIONS OFF
)

In this case, cmake will pass the necessary flag during compilation (-std=gnu++11 or -std=c++11 etc).

Do I need to set a minimum standard or force the test to compile with C++11? In other words, should I use target_compile_features or set_target_properties?

Copy link
Member

Choose a reason for hiding this comment

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

@VladimirShaleev Thank you for your feedback. The reason behind is because in Conan 1.x , the settings.compiler.cppstd is not configured by default, so the test package will use what is configured by the compiler as standard version (e.g. GCC5 will fail). In Conan 2.x, the c++ standard always follows what is configured by settings.compiler.cppstd, so it would not be needed to use target_compile_features neither set_target_properties in that case (future, when dropping Conan 1.x). But answering your question: target_compile_features is more than fine because it will check if the compiler supports c++11 and accommodate in case needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@uilianries Thanks for your reply! I'll follow your advice and save target_compile_features with cxx_std_11

@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 5 (6e97b2fde2004e657a98b04b28c4ed6ceb29ded4):

  • ipaddress/1.0.1:
    All packages built successfully! (All logs)

Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 5 (6e97b2fde2004e657a98b04b28c4ed6ceb29ded4):

  • ipaddress/1.0.1:
    All packages built successfully! (All logs)

Copy link
Member

@RubenRBS RubenRBS left a comment

Choose a reason for hiding this comment

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

Thanks a lot! This looks super good now :)

@VladimirShaleev
Copy link
Contributor Author

Thank you, Rubén, for your insightful feedbacks during the pull request review) I really appreciate it!

@conan-center-bot conan-center-bot merged commit 2c8bcee into conan-io:master Apr 19, 2024
13 checks passed
franramirez688 pushed a commit to toge/conan-center-index that referenced this pull request Apr 23, 2024
* ipaddress: add recipe

* Improved readability and template compliance from package_templates in conanfile.py

* Compiling a test package using C++11

* Target compile features cxx_std_11
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.

None yet

6 participants