Commit dfafad8a authored by Thibault Saunier's avatar Thibault Saunier Committed by Thibault Saunier

flatpak: Install git-phab and pre-commit in a virtual env

And activate that env when we setup our dev env
Reviewed-by: Alexandru Băluț's avatarAlex Băluț <alexandru.balut@gmail.com>
Differential Revision: https://phabricator.freedesktop.org/D1663
parent 943cc4aa
......@@ -25,4 +25,5 @@ help/index.cache
.bashrc
*.flatpak-builder/
build/flatpak/Pitivi.*.json
build/flatpak/pyvenv/*
build/devel/
......@@ -47,6 +47,7 @@ then
alias pitivi="ptvenv $PITIVI_REPO_DIR/bin/pitivi"
source $PITIVI_REPO_DIR/build/flatpak/pyvenv/bin/activate
export PS1="(ptv-flatpak) $PS1"
export PATH="$FLATPAK_ENVPATH/bin/:$PATH"
......
......@@ -26,6 +26,7 @@ import shutil
import subprocess
import sys
import tempfile
import venv
from urllib.parse import urlparse
from urllib.request import urlretrieve
......@@ -539,6 +540,20 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
else:
Console.message("Using Pitivi prefix in %s", self.prefix)
venv_path = os.path.join(self.scriptdir, "pyvenv")
activate_script = os.path.join(venv_path, "bin", "activate")
if not os.path.isdir(venv_path):
print("Installing development tools in a virtual env.")
venv.create(venv_path, with_pip=True)
subprocess.check_call(
"source %s && pip install pre-commit git-phab" % (
activate_script), shell=True)
if self.update:
subprocess.check_call(
"source %s && pip install -U pre-commit git-phab" % (
activate_script), shell=True)
if not self.check and not self.update:
self.run_in_sandbox(*self.args, exit_on_failure=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment