-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add support for cpr 1.6.2 #5353
Conversation
recipes/cpr/all/conanfile.py
Outdated
@property | ||
def _supports_darwinssl(self): | ||
# https://github.com/whoshuu/cpr/releases/tag/1.6.1 | ||
return tools.Version(self.version) >= "1.6.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return tools.Version(self.version) >= "1.6.1" | |
return tools.Version(self.version) >= "1.6.1" and tools.is_apple_os(self.settings.os) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read this change and I could have SWORN I already did it. Guess not, lol. On it.
recipes/cpr/all/conanfile.py
Outdated
"with_openssl": [True, False], | ||
"with_winssl": [True, False], | ||
"with_darwinssl": [True, False], | ||
"no_ssl": [True, False], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was afraid of this...
Can we copy the curl recipe and use an with_ssl
and provide string options? and deprecate the older two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know, that makes total sense, and frankly I don't know why I didn't think about it. Will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a proper way to deprecate options, by the way? I took a quick peek at the docs and didn't see it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#5020 We just wrote it recently 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh awesome! Will flip to using that way
This comment has been minimized.
This comment has been minimized.
I know why CI is failing, small error on my part with one of the old SSL options. Will be fixed along with everything else... |
This comment has been minimized.
This comment has been minimized.
recipes/cpr/all/conanfile.py
Outdated
@@ -18,16 +22,14 @@ class CprConan(ConanFile): | |||
"fPIC": [True, False], | |||
"with_openssl": [True, False], | |||
"with_winssl": [True, False], | |||
"with_darwinssl": [True, False], | |||
"no_ssl": [True, False], | |||
"ssl": ["openssl", "darwinssl", "winssl", AUTO_SSL, NO_SSL] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please stick with our usual, with_
syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
recipes/cpr/all/conanfile.py
Outdated
SSL_CURL_LIBS = { | ||
"openssl": "openssl", | ||
"darwinssl": "darwinssl", | ||
"winssl": "schannel" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be easier if we used the name value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, not sure what you're referring to here. Could you clarify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bit of complexity from the CPR values being different from the curl recipe...
But looking at it again, it's just combinatorics hell, since the options and support have changed a lot it's very complicated
recipes/cpr/all/conanfile.py
Outdated
from conans import ConanFile, CMake, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
import os | ||
|
||
|
||
class CprConan(ConanFile): | ||
AUTO_SSL = "auto" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Custom attributes should always be prefixed with _
This comment has been minimized.
This comment has been minimized.
recipes/cpr/all/conanfile.py
Outdated
self.output.info("Auto SSL is not available below version 1.6.0. Falling back to openssl") | ||
return "openssl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this should be moved to config_options
such that the default is sensibly configured. We also try to no shock the user by override their explicit input and a minimum this should be a raise ConanInvalidConfiguration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes total sense. Will fix this up later today.
recipes/cpr/all/conanfile.py
Outdated
ssl_library = self._get_ssl_library() | ||
if not self._supports_ssl_library(ssl_library): | ||
raise ConanInvalidConfiguration( | ||
f"Invalid SSL selection for the given configuration: {SSL_FAILURE_MESSAGES[ssl_library]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are trying typing to maintain support for older python versions, could you please use "".format()
instead please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah shoot - wasn't thinking about that. I've been in the f-string
mindset for too long 😅
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Just wanted to bump this. Anything you want to see changed? Or are we good to push this through? |
Requested review: New feature is starting to kick in? You can take a peak at my bot, 21 is fairly high so theres a bit of a back lock and lots of new PRs (which tend to get seen first) |
right now, the selection is completely random. we'll see how is it going, and if further tuning is needed. |
recipes/cpr/all/conanfile.py
Outdated
@@ -1,9 +1,13 @@ | |||
from typing import no_type_check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from typing import no_type_check |
Because this will break python2 and there is no typing in conanfiles at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bleh, I think my editor added this in and I didn't catch it. Thanks.
recipes/cpr/all/conanfile.py
Outdated
ssl_library = self._get_ssl_library() | ||
# Make sure libcurl uses the same SSL implementation | ||
if self.options.get_safe("with_openssl", False): | ||
# self.options["libcurl"].with_openssl = True # deprecated in https://github.com/conan-io/conan-center-index/pull/2880 | ||
self.options["libcurl"].with_ssl = "openssl" | ||
if self.options.get_safe("with_winssl", False): | ||
# self.options["libcurl"].with_winssl = True # deprecated in https://github.com/conan-io/conan-center-index/pull/2880 | ||
self.options["libcurl"].with_ssl = "schannel" | ||
# "auto" will be handled by cpr | ||
if self._supports_ssl_library(ssl_library) and ssl_library in SSL_CURL_LIBS: | ||
self.options["libcurl"].with_ssl = SSL_CURL_LIBS[ssl_library] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would instead raise in validate
, if libcurl uses different SSL implementation because overriding user's desires is not something we should do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okey doke. I did this primarily to mirror what was already there but I'll give this a fiddle and see how it works out.
recipes/cpr/all/conanfile.py
Outdated
if library not in validators: | ||
# This should never happen, as the options are validated by conan. | ||
raise ValueError("Unknown SSL library: {}".format(library)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if library not in validators: | |
# This should never happen, as the options are validated by conan. | |
raise ValueError("Unknown SSL library: {}".format(library)) |
Let's just remove, because accessing validators[library]
will raise more-or-less the same error and as you noted it's not gonna happen at all.
+ find_package(CURL) | ||
+ if(CURL_FOUND) | ||
+ message(STATUS "Curl found on this system.") | ||
else() | ||
- find_package(CURL COMPONENTS HTTP) | ||
- if(CURL_FOUND) | ||
- message(STATUS "Curl found on this system.") | ||
- else() | ||
- message(FATAL_ERROR "Curl not found on this system. To use the build in version set CPR_FORCE_USE_SYSTEM_CURL to OFF.") | ||
- endif() | ||
+ message(FATAL_ERROR "Curl not found on this system. To use the build in version set CPR_FORCE_USE_SYSTEM_CURL to OFF.") | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use find_package(REQUIRED) here?
All green in build 5 (
|
I detected other pull requests that are modifying cpr/all recipe: This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big improvement, including deprecation process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, so many changes for new version
Specify library name and version: cpr/1.6.2
I had just worked on cpr/1.6.0, and now that cpr/1.6.2 is released, I figured I'd give it an update :) Flags are added for darwinssl, and for disabling ssl entirely (we previously disabled SSL if none was selected, but doing so precludes CPR from attempting to auto-detect).
conan-center hook activated.