Skip to content

Commit

Permalink
Support conan version 1 & 2
Browse files Browse the repository at this point in the history
  • Loading branch information
henryborchers committed Oct 11, 2023
1 parent bcdfd27 commit bb03a0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions uiucprescon/build/conan/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def __init__(self, fp):
self._fp = fp

def parse(self) -> Dict[str, List[str]]:
data = dict()
data = {}
for subject_chunk in self.iter_subject_chunk():
subject_title = subject_chunk[0][1:-1]

Expand Down Expand Up @@ -70,19 +70,19 @@ class ConanBuildInfoTXT(AbsConanBuildInfo):

def parse(self, filename: str) -> ConanBuildInfo:
# def parse(self, filename: str) -> Dict[str, Union[str, List[str]]]:
with open(filename, "r") as f:
with open(filename, "r", encoding="utf-8") as f:
parser = ConanBuildInfoParser(f)
data = parser.parse()
definitions = data['defines']
include_paths = data['includedirs']
lib_paths = data['libdirs']
bin_paths = data['bindirs']
libs = data['libs']
names = []
for value in data.keys():
if not value.startswith("name_"):
continue
names.append(value.replace("name_", ""))
names: List[str] = [
value.replace("name_", "")
for value in data
if value.startswith("name_")
]
# print(names)
libsmetadata: Dict[str, ConanLibraryMetadata] = {}
for library_name in names:
Expand Down
2 changes: 1 addition & 1 deletion uiucprescon/build/conan/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def build_deps_with_conan(
#
conaninfotext = os.path.join(build_dir, "conaninfo.txt")
if os.path.exists(conaninfotext) and announce:
with open(conaninfotext) as r:
with open(conaninfotext, "r", encoding="utf-8") as r:
announce(r.read(), 5)
build_locations = [
build_dir,
Expand Down

0 comments on commit bb03a0e

Please sign in to comment.