Add a deployer to extract the source of a package
This commit is contained in:
parent
cba3ebfb5b
commit
6cc12121a2
|
@ -0,0 +1,36 @@
|
|||
# Toolchain builder for the Serene programming language
|
||||
#
|
||||
# Copyright (c) 2019-2023 Sameer Rahmani <lxsameer@gnu.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, version 2.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
from conan.tools.files import copy
|
||||
|
||||
from conf.utils import copy_tree
|
||||
|
||||
|
||||
def deploy(graph, output_folder, **kwargs):
|
||||
# Note the kwargs argument is mandatory to be robust against future changes.
|
||||
for name, dep in graph.root.conanfile.dependencies.items():
|
||||
if dep.folders is None:
|
||||
raise RuntimeError(
|
||||
f"Sources missing for {name} dependency.\n"
|
||||
"This deployer needs the sources of every dependency present to work, either building from source, "
|
||||
"or by using the 'tools.build:download_source' conf."
|
||||
)
|
||||
|
||||
output = Path(output_folder) / str(dep.ref).split("@")[0]
|
||||
print(f"Copying {dep.package_folder} to {output}")
|
||||
copy_tree(dep.package_folder, output)
|
Loading…
Reference in New Issue