Skip to content

Commit

Permalink
Rename tmp Python file to a more explicit name
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Nov 28, 2024
1 parent d8200a3 commit 0d5d0fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ def _python_installs(self):
self.output.info("Collecting python installs")
python_installs = {}

temp_exec = "temp.py"
collect_python_installs = "collect_python_installs.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)
save(self, collect_python_installs, code)

buffer = StringIO()
self.run(f"""python {temp_exec}""", env = "virtual_python_env", stdout = buffer)
rm(self, temp_exec, ".")
self.run(f"""python {collect_python_installs}""", env = "virtual_python_env", stdout = buffer)
rm(self, collect_python_installs, ".")

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

0 comments on commit 0d5d0fe

Please sign in to comment.