bootstrap-toolchain/conf/toolchain_deployer.py

40 lines
1.6 KiB
Python

# 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
# Only deploy the `toolchain` package
def deploy(graph, output_folder, **kwargs):
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."
)
name = str(dep.ref).split("@")[0].split("/")[0]
if name == "stage3-sysroot":
output = Path(output_folder) / name
print(f"Copying {dep.package_folder} to {output}")
copy_tree(dep.package_folder, output)
else:
print(f"Ignoring the '{name}' package")