Skip to content

Commit

Permalink
Add gitbark site-packages to venv.
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Nov 8, 2023
1 parent c749658 commit 718b7b7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gitbark/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,20 @@ def create_db(self) -> None:
)

def create_env(self) -> None:
# Create venv
os.makedirs(self.env_path, exist_ok=True)
cmd(sys.executable, "-m", "venv", self.env_path, cwd=self.path)

# Add additional site-packages
exec_path = os.path.join(self.env_path, "bin", "python")
env_path = cmd(exec_path, "-c", "import sys; print(':'.join(sys.path))")[
0
].split(":")
additional = [p for p in sys.path[1:] if p not in env_path]
env_site = self.get_env_site_packages()
with open(os.path.join(env_site, "gitbark.pth"), "w") as f:
f.write("\n".join(additional))

def install_modules(self, requirements: bytes) -> None:
r_file = os.path.join(self.bark_directory, "requirements.txt")

Expand Down

0 comments on commit 718b7b7

Please sign in to comment.