Skip to content

Commit

Permalink
Change environment to gater Python dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Nov 15, 2024
1 parent 0e36320 commit 35e52ef
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,22 @@ def _python_installs(self):
python_installs = {}

# list of python installs
run_env = VirtualRunEnv(self)
env = run_env.environment()
# run_env = VirtualRunEnv(self)
# env = run_env.environment()
#env.prepend_path("PYTHONPATH", str(self._site_packages.as_posix()))
venv_vars = env.vars(self, scope = "run")
# venv_vars = env.vars(self, scope = "run")

outer = '"' if self.settings.os == "Windows" else "'"
inner = "'" if self.settings.os == "Windows" else '"'
buffer = StringIO()
with venv_vars.apply():
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 = "conanrun",
stdout = buffer)
# with venv_vars.apply():
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 = "run",
stdout = buffer)

print(f"############################################################ {buffer.getvalue()}")
# for name, value in venv_vars.items():
# print(f"{name}={value}")
packages = str(buffer.getvalue()).strip('\r\n').split(";")
for package in packages:
name, version = package.split(",")
Expand Down

0 comments on commit 35e52ef

Please sign in to comment.