Skip to content

Commit

Permalink
Fix openapi module plugins installation on venv
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-psb committed Jul 3, 2024
1 parent 9e8436d commit f29772d
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/pulp_docs/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ class OpenAPIGenerator:
"""

def __init__(self, plugins: list[PulpPlugin], dry_run=False):
self.plugins = plugins + [PulpPlugin("pulpcore", "core", False)]
self.pulpcore = PulpPlugin("pulpcore", "core", False)
self.plugins = plugins + [self.pulpcore]
self.dry_run = dry_run

# setup working tmpdir
Expand All @@ -91,18 +92,11 @@ def generate(self, target_dir: Path):

def setup_venv(self, plugin: PulpPlugin):
"""
Creates virtualenv with plugin + pulpcore.
Creates virtualenv with plugin.
"""
install_cmd = []
create_venv_cmd = ("python", "-m", "venv", self.venv_path)

if plugin.is_subpackage or plugin.name == "pulpcore":
if Path(self.venv_path).exists():
return
install_cmd = ["pip", "install", "pulpcore"]
else:
url = f"git+{plugin.get_remote_url()}"
install_cmd = ["pip", "install", "pulpcore", url]
url = plugin.get_remote_url() if not plugin.is_subpackage else self.pulpcore.get_remote_url()
install_cmd = ["pip", "install", f"git+{url}"]

if self.dry_run is True:
print(" ".join(create_venv_cmd))
Expand Down

0 comments on commit f29772d

Please sign in to comment.