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
Feature: allow arbitrary defines in conan new templates #8718
Conversation
Signed-off-by: SSE4 <tomskside@gmail.com>
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.
Needs tests, please add.
@@ -199,6 +199,7 @@ def new(self, *args): | |||
help='Generate a .gitignore with the known patterns to excluded') | |||
parser.add_argument("-ciu", "--ci-upload-url", | |||
help='Define URL of the repository to upload') | |||
parser.add_argument('-d', '--define', action='append') |
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.
Sure this doesn't need the Extender
custom action?
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, I am not sure I understand, what do you mean... could you possibly describe your question in more details, e.g. with some examples?
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 have Extender class in our command.py file:
conan/conans/client/command.py
Line 34 in beaca41
class Extender(argparse.Action): |
It is basically there to implement the append
action it seems. Is the Extender class legacy code not needed? If that is the case maybe we can get rid of it? (Not in this PR, of course, in another one, but just wondering if the action='append'
could have some limitation or problem)
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.
seems so, at least append
exists in 2.7, so Extender
seems to be a redundant bicycle for me, could be removed in conan 2.0
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 it is really redundant, then let's drop it today, for next 1.35? Of course if we are relatively sure this will not be breaking users, but if we are, no need to wait until Conan 2.0.
This looks good, then, merging.
Signed-off-by: SSE4 <tomskside@gmail.com>
Signed-off-by: SSE4 <tomskside@gmail.com>
@memsharded added test |
@@ -199,6 +199,7 @@ def new(self, *args): | |||
help='Generate a .gitignore with the known patterns to excluded') | |||
parser.add_argument("-ciu", "--ci-upload-url", | |||
help='Define URL of the repository to upload') | |||
parser.add_argument('-d', '--define', action='append') |
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 have Extender class in our command.py file:
conan/conans/client/command.py
Line 34 in beaca41
class Extender(argparse.Action): |
It is basically there to implement the append
action it seems. Is the Extender class legacy code not needed? If that is the case maybe we can get rid of it? (Not in this PR, of course, in another one, but just wondering if the action='append'
could have some limitation or problem)
allow arbitrary defines in
conan new
templatese.g. instead of running:
I may run:
which allows further automation on top of
conan new
, for instance, some script may fetch license, description, topics, homepage, tarball URL and sha256 in order to pass em to the template.Changelog: Feature: Allow arbitrary defines in
conan new
templates.Docs: conan-io/docs#2051
develop
branch, documenting this one.Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.