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

autopackager deprecation #3253

Merged
Merged
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
58 changes: 5 additions & 53 deletions reference/tools/files/packaging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,10 @@
conan.tools.files AutoPackager
==============================

The ``AutoPackager`` together with the layout() feature, allow to automatically
package the files following the declared information in the ``layout()`` method:

It will copy:

- Files from ``self.cpp.local.includedirs`` to ``self.cpp.package.includedirs``
- Files from ``self.cpp.local.libdirs`` to ``self.cpp.package.libdirs``
- Files from ``self.cpp.local.bindirs`` to ``self.cpp.package.bindirs``
- Files from ``self.cpp.local.srcdirs`` to ``self.cpp.package.srcdirs``
- Files from ``self.cpp.local.builddirs`` to ``self.cpp.package.builddirs``
- Files from ``self.cpp.local.resdirs`` to ``self.cpp.package.resdirs``
- Files from ``self.cpp.local.frameworkdirs`` to ``self.cpp.package.frameworkdirs``

The patterns of the files to be copied can be defined with the `.patterns` property of the ``AutoPackager`` instance.
The default patterns are:

.. code:: python

packager = AutoPackager(self)
packager.patterns.include == ["*.h", "*.hpp", "*.hxx"]
packager.patterns.lib == ["*.so", "*.so.*", "*.a", "*.lib", "*.dylib"]
packager.patterns.bin == ["*.exe", "*.dll"]
packager.patterns.src == []
packager.patterns.build == []
packager.patterns.res == []
packager.patterns.framework == []

Usage:

.. code:: python

from conan import ConanFile
from conan.tools.files import AutoPackager

class Pkg(ConanFile):

def layout(self):
...

def package(self):
packager = AutoPackager(self)
packager.patterns.include = ["*.hpp", "*.h", "include3.h"]
packager.patterns.lib = ["*.a"]
packager.patterns.bin = ["*.exe"]
packager.patterns.src = ["*.cpp"]
packager.patterns.framework = ["sframe*", "bframe*"]
packager.run()


.. currentmodule:: conan.tools.files

.. autoclass:: AutoPackager
:members:
.. warning::

This feature is **deprecated**, and will be removed in future Conan 2.0.X version.
It was used to automatically deduce what to ``copy()`` in the ``package()`` method.

The recommended approach is to use explicit ``copy()`` calls in the ``package()`` method, as explained
in the rest of the documentation.