You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
913 B

from pathlib import Path
from jinja2 import Template
from conan.tools.env import VirtualBuildEnv
from conans.model import Generator
class GitHubActionsBuildEnv(Generator):
@property
def filename(self):
filepath = str(Path(self.conanfile.generators_folder).joinpath("activate_github_actions_buildenv"))
if self.conanfile.settings.get_safe("os") == "Windows":
if self.conanfile.conf.get("tools.env.virtualenv:powershell", check_type = bool):
filepath += ".ps1"
else:
filepath += ".bat"
else:
filepath += ".sh"
return filepath
@property
def content(self):
template = Template("""{% for k, v in envvars.items() %}echo "{{ k }}={{ v }}" >> $GITHUB_ENV\n{% endfor %}""")
envvars = self.conanfile.buildenv_info.vars(self.conanfile)
return template.render(envvars = envvars)