mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-03 18:30:38 +08:00
Simplify python command string in conanfile.py
Removed unnecessary string manipulation based on operating system in conanfile.py. The prior implementation used different types of quotes depending on the OS to form a python command string. This change applies one single format for all OS's simplifying the code. Contributes to CURA-11079
This commit is contained in:
parent
cb050ce46d
commit
e5ce3b0893
@ -173,11 +173,9 @@ class CuraConan(ConanFile):
|
||||
env.prepend_path("PYTHONPATH", str(self._site_packages.as_posix()))
|
||||
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({{dist.metadata[{inner}Name{inner}]: {{{inner}version{inner}: dist.version}} for dist in importlib_metadata.distributions()}}){outer}""",
|
||||
self.run("""python -c "import importlib_metadata; print({dist.metadata['Name']: {'version': dist.version} for dist in importlib_metadata.distributions()})" """,
|
||||
env = "conanrun",
|
||||
output = buffer)
|
||||
return str(buffer.getvalue()).split("-----------------\n")[-1].strip()
|
||||
|
Loading…
x
Reference in New Issue
Block a user