[question][2.0] exports_sources with .gitignore support
See original GitHub issueI’m currently starting to port conan 1.x recipes in our organization to conan 2.0 syntax using conan 1.52.0. One pattern we use in most of our projects is this syntax for exports_sources in order not to export files ignored by git:
exports_sources = ["*", "!.gitignore"] + ["!%s" % x for x in tools.Git().excluded_files()]
But apparently, support for excluded_files() is not provided in conan.tools.scm.git. Besides that, #4023 proposed to use the SCM feature, which is also deprecated.
As of now, I don’t see a chance to migrate this behaviour to conan 2.0 except reimplementing it ourselfs. Is there another solution I’ve overseen? Is there a chance to make excluded_files()
available in conan.tools.scm.git
or is there a rationale behind removing it? Or asking more general: Will there be a mechanism in exports_sources to not copy files ignored by git?
- I’ve read the CONTRIBUTING guide.
Issue Analytics
- State:
- Created a year ago
- Comments:14 (8 by maintainers)
Top GitHub Comments
Oh, yes, sorry, this should have been done directly for 1.X to allow the migration, I will backport it to 1.54
Yes, both approaches are equally valid IMO. In the above I wanted to remove the “magic” of the
copy()
, so even if it requires a couple of extra lines, it would be good, and it should work too. And it can be much much faster, which is something that for big projects might make a difference. We can document both approaches, as thegit.included_files()
is now decoupled.