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

Add warning about not having conditional source methods #3773

Open
wants to merge 1 commit into
base: release/2.4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions reference/conanfile/methods/source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ The ``source()`` method can implement different strategies for retrieving the so
- Executing a ``download()`` + ``unzip()`` or a combined ``get()`` (internally does download + unzip) to download a tarball, tgz, or zip archive.
- Fetching the source code for itself, from its repository, whose coordinates have been captured in the ``conandata.yml`` file in the ``export()`` method. This is the strategy that would be used to manage the source code for packages in which the ``conanfile.py`` lives in the package itself, but that for some reason we don't want to put the source code in the recipe (like not distributing our source code, but being able to distribute our package binaries).

.. note::

The ``source()`` method _MUST NOT_ be conditional to any configuration, so it should be the same for all configurations.
Settings and options access is disallowed in this method, and recipes should not set any conditionals based on the platform either
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can relax and suggest that platform.system and similar can be used at the responsibility of users and knowing it will not be cross-platform, etc? Because this is kind of a bad thing, but it sometimes happen


The ``source()`` method executes in the ``self.source_folder``, the current working directory will be equal to that folder (which value is derived from ``layout()`` method).

Expand Down