22
33from pathlib import Path
44from string import Template
5+ from textwrap import dedent
56
67from pydantic import DirectoryPath
78
@@ -23,10 +24,10 @@ def _create_conanfile(conan_file: Path, dependencies: list[ConanDependency]) ->
2324 from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
2425
2526 class MyProject(ConanFile):
26- name = myproject
27+ name = " myproject"
2728 version = "1.0"
2829 settings = "os", "compiler", "build_type", "arch"
29- requires = "zlib/1.2.13"
30+ requires = ${dependencies}
3031 generators = "CMakeDeps"
3132
3233 def layout(self):
@@ -41,7 +42,7 @@ def build(self):
4142 cmake.configure()
4243 cmake.build()"""
4344
44- template = Template (template_string )
45+ template = Template (dedent ( template_string ) )
4546
4647 values = {
4748 'dependencies' : [dependency .requires () for dependency in dependencies ],
@@ -58,8 +59,9 @@ def generate_conanfile(self, directory: DirectoryPath, dependencies: list[ConanD
5859
5960 # If the file exists then we need to inject our information into it
6061 if conan_file .exists ():
61- with open (conan_file , encoding = 'utf-8' ) as file :
62- file_contents = file .read ()
62+ raise NotImplementedError (
63+ 'Updating existing conanfile.py is not yet supported. Please remove the file and try again.'
64+ )
6365
6466 else :
6567 directory .mkdir (parents = True , exist_ok = True )
0 commit comments