Skip to content

Commit

Permalink
(win build) make it work locally again
Browse files Browse the repository at this point in the history
part if CURA-11622
  • Loading branch information
rburema committed Nov 27, 2024
1 parent 2ef1462 commit b7a5b2f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@ def _python_installs(self):
self.output.info("Collecting python installs")
python_installs = {}

outer = '"' if self.settings.os == "Windows" else "'"
inner = "'" if self.settings.os == "Windows" else '"'
temp_exec = "temp.py"
code = f"import importlib.metadata; print(';'.join([(package.metadata['Name']+','+ package.metadata['Version']) for package in importlib.metadata.distributions()]))"
save(self, temp_exec, code)

buffer = StringIO()
self.run(f"""python -c {outer}import importlib.metadata; print({inner};{inner}.join([(package.metadata[{inner}Name{inner}]+{inner},{inner}+ package.metadata[{inner}Version{inner}]) for package in importlib.metadata.distributions()])){outer}""",
env = "virtual_python_env",
stdout = buffer)
self.run(f"""python {temp_exec}""", env = "virtual_python_env", stdout = buffer)
rm(self, temp_exec, ".")

packages = str(buffer.getvalue()).strip('\r\n').split(";")
for package in packages:
Expand Down

0 comments on commit b7a5b2f

Please sign in to comment.