-
Notifications
You must be signed in to change notification settings - Fork 995
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
Implemented --query flag in conan upload
(#2445)
#3377
Conversation
You can now use the --query flag in the `conan upload` command like you would in `conan remove`. In other words, you can use a query to specify which packages will be uploaded to the server.
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.
This feature is nice, I think it makes sense and could be merged. However, it would require to add some test of this new feature. Please try to to having a look to existing tests (look for those using TestServer
) and ask for help if necessary! Many thanks!
conans/client/conan_api.py
Outdated
@@ -728,8 +728,9 @@ def search_packages(self, reference, query=None, remote_name=None, outdated=Fals | |||
return recorder.get_info() | |||
|
|||
@api_method | |||
def upload(self, pattern, package=None, remote_name=None, all_packages=False, force=False, | |||
confirm=False, retry=2, retry_wait=5, skip_upload=False, integrity_check=False, | |||
def upload(self, pattern, package=None, query=None, remote_name=None, |
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 say add the new argument in the last position, less likely to break to users of the API
Would be happy to take a look at creating tests, will do this asap. :) |
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.
Tests looks very good too, great job!
conans/test/command/upload_test.py
Outdated
@@ -123,13 +167,14 @@ def gzopen_patched(name, mode="r", fileobj=None, compresslevel=None, **kwargs): | |||
self.assertIn("ERROR: Error gzopen conan_package.tgz", client.out) | |||
|
|||
export_folder = client.client_cache.package(package_ref) | |||
print(export_folder) |
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.
Remove print
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.
Great contribution! Thanks a lot 😃
conans/client/command.py
Outdated
_PATTERN_OR_REFERENCE_HELP = ("Pattern or package recipe reference, e.g., 'boost/*', " | ||
"'MyPackage/1.2@user/channel'") | ||
_PATTERN_OR_REFERENCE_HELP = ("Pattern or package recipe reference, e.g., '{}', " | ||
"'{}'".format(_REFERENCE_EXAMPLE, _PATTERN_EXAMPLE)) |
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'd rather use %s
to format the string to be consistent with Conan codebase
conans/client/command.py
Outdated
_QUERY_HELP = ("Packages query: 'os=Windows AND (arch=x86 OR compiler=gcc)'. The " | ||
"'pattern_or_reference' parameter has to be a reference: MyPackage/1.2@user/channel") | ||
_QUERY_HELP = ("Packages query: '{}'. The 'pattern_or_reference' parameter has " | ||
"to be a reference: {}".format(_QUERY_EXAMPLE, _REFERENCE_EXAMPLE)) |
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.
Same thing here
* .format replaced with old-style Python 2 formatting for consistency. * Removed extraneous print statement.
Removed extraneous print statement and removed new-style formatting for consistency. :) |
Made changes in conan-io/docs for the new option -- see: conan-io/docs#772 |
Merged! Will be in conan 1.7. Thanks again for your contribution :) |
Awesome, and no problem :D |
…3377) * Implemented --query flag in `conan upload` (conan-io#2445) You can now use the --query flag in the `conan upload` command like you would in `conan remove`. In other words, you can use a query to specify which packages will be uploaded to the server. * Moved query to final argument to prevent breakage for API users * Added tests for `conan upload --query` * Made changes from code review. * .format replaced with old-style Python 2 formatting for consistency. * Removed extraneous print statement.
You can now use the --query flag in the
conan upload
command like youwould in
conan remove
. In other words, you can use a query to specifywhich packages will be uploaded to the server.
Will update documentation tonight.
develop
branch, documenting this one. Also adding a description of the changes in thechangelog.rst
file. https://github.com/conan-io/docs