[pitivi] build: Remove non-development functionality from pitivi-flatpak
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] build: Remove non-development functionality from pitivi-flatpak
- Date: Mon, 19 Feb 2018 23:11:28 +0000 (UTC)
commit dd707d91c23b3211daf682902464933354377f0b
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Mon Feb 19 23:45:01 2018 +0100
build: Remove non-development functionality from pitivi-flatpak
bin/pitivi-env | 4 +-
bin/pitivi.installer.desktop | 7 --
build/flatpak/pitivi-flatpak | 178 +++++++++++++++++-------------------------
docs/Install_with_flatpak.md | 47 +++++-------
pre-commit.hook | 2 +-
5 files changed, 94 insertions(+), 144 deletions(-)
---
diff --git a/bin/pitivi-env b/bin/pitivi-env
index 3034b11..bffbf66 100755
--- a/bin/pitivi-env
+++ b/bin/pitivi-env
@@ -18,7 +18,7 @@ export CURRENT_GST=$FLATPAK_ENVPATH
export PATH="$FLATPAK_ENVPATH/bin/:$PATH"
# Use ptvenv for entering or running commands in the sandbox.
-alias ptvenv="$PITIVI_REPO_DIR/build/flatpak/pitivi-flatpak -d"
+alias ptvenv="$PITIVI_REPO_DIR/build/flatpak/pitivi-flatpak"
echo "-> Setting up the prefix for the sandbox..."
# This builds the local flatpak repo if it is not yet built.
@@ -50,7 +50,7 @@ then
alias binstall="ptvenv ninja -C mesonbuild/ install"
# Prefer to run some binaries in the sandbox. For example "python3".
- for i in `$PITIVI_REPO_DIR/build/flatpak/pitivi-flatpak -q -d ls /app/bin/`;
+ for i in `$PITIVI_REPO_DIR/build/flatpak/pitivi-flatpak -q ls /app/bin/`;
do
alias $i="ptvenv $i"
done
diff --git a/build/flatpak/pitivi-flatpak b/build/flatpak/pitivi-flatpak
index 12eb5d7..441e2bb 100755
--- a/build/flatpak/pitivi-flatpak
+++ b/build/flatpak/pitivi-flatpak
@@ -334,15 +334,12 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
def __init__(self):
self.name = "Pitivi"
self.sdk_repo = None
- self.app_repo = None
self.runtime = None
self.locale = None
self.sdk = None
- self.app = None
self.packs = []
self.update = False
- self.devel = False
self.json = None
self.args = []
self.build = False
@@ -412,10 +409,6 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
url="http://sdk.gnome.org/repo/",
repo_file="https://sdk.gnome.org/gnome.flatpakrepo"))
- self.app_repo = repos.add(
- FlatpakRepo("pitivi",
- url="http://flatpak.pitivi.org/",
- repo_file="http://flatpak.pitivi.org/pitivi.flatpakrepo"))
sdk_branch = SDK_BRANCH[self.branch]
self.runtime = FlatpakPackage(
"org.gnome.Platform", sdk_branch, self.sdk_repo, "x86_64")
@@ -423,30 +416,28 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
"org.gnome.Platform.Locale", sdk_branch, self.sdk_repo, "x86_64")
self.sdk = FlatpakPackage(
"org.gnome.Sdk", sdk_branch, self.sdk_repo, "x86_64")
- self.app = FlatpakPackage(
- "org.pitivi.Pitivi", self.branch, self.app_repo, "x86_64")
- self.packs = [self.runtime, self.locale]
+ self.packs = [self.runtime, self.locale, self.sdk]
if self.bundle:
self.build = True
- if self.devel:
- self.packs.append(self.sdk)
- else:
- self.packs.append(self.app)
- self.local_repos_path = "/nowhere/really/"
-
self.json = os.path.join(self.scriptdir, self.build_name + ".json")
- def run(self):
- if self.clean and os.path.exists(self.prefix):
- shutil.rmtree(self.prefix)
+ if not self.args:
+ self.args.append(os.path.join(self.scriptdir, "enter-env"))
- if self.update:
- self.update_all()
+ def run(self):
+ if self.clean:
+ try:
+ shutil.rmtree(self.prefix)
+ except FileNotFoundError:
+ pass
- if self.devel:
+ fresh_install = not os.path.exists(self.prefix)
+ if fresh_install or self.update:
+ self.install_flatpak_runtimes()
self.setup_sandbox()
+ self.install_development_tools()
if self.check:
self.run_in_sandbox("gst-validate-launcher",
@@ -456,16 +447,12 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
if self.bundle:
self.update_bundle()
- return
- if not self.devel:
- self.install_all()
- self.app.run_app(*self.args)
+ if not self.check and not self.update and not self.bundle:
+ assert self.args
+ self.run_in_sandbox(*self.args, exit_on_failure=True)
def update_bundle(self):
- if not os.path.exists(self.prefix):
- self.setup_sandbox()
-
if not os.path.exists(self.repodir):
os.mkdir(self.repodir)
@@ -495,84 +482,75 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
update_repo_args.append(self.repodir)
- Console.message("Updating repo '%s'", "'".join(update_repo_args))
+ Console.message("Updating repo: '%s'", "' '".join(update_repo_args))
try:
subprocess.check_call(update_repo_args)
except subprocess.CalledProcessError:
self.exit(1)
def setup_sandbox(self):
- """Creates the sandbox."""
- fresh_install = not os.path.exists(self.prefix)
- if fresh_install or self.update:
- self.install_all()
- Console.message("Building Pitivi %s and dependencies in %s",
- self.branch, self.prefix)
+ """Creates and updates the sandbox."""
+ Console.message("Building Pitivi %s and dependencies in %s",
+ self.branch, self.prefix)
- json_template = os.path.join(
- self.scriptdir, "%s.template.json" % self.name.lower())
- expand_json_file(json_template, self.json,
- self.local_repos_path, self.gst_version,
- self.branch)
+ json_template = os.path.join(
+ self.scriptdir, "%s.template.json" % self.name.lower())
+ expand_json_file(json_template, self.json,
+ self.local_repos_path, self.gst_version,
+ self.branch)
- builder_args = ["flatpak-builder", "--force-clean",
- "--ccache", self.prefix, self.json]
- if not self.bundle:
- builder_args.append("--build-only")
+ builder_args = ["flatpak-builder", "--force-clean",
+ "--ccache", self.prefix, self.json]
+ if not self.bundle:
+ builder_args.append("--build-only")
- try:
- subprocess.check_call(["flatpak-builder", "--version"])
- except FileNotFoundError:
- Console.message("\n%sYou need to install flatpak-builder%s\n",
- Colors.FAIL, Colors.ENDC)
- self.exit(1)
- subprocess.check_call(builder_args, cwd=self.scriptdir)
-
- if not os.path.isdir("mesonbuild/"):
- # Create the build directory.
- meson_args = ["meson", "mesonbuild/", "--prefix=/app",
- "--libdir=lib", "-Ddisable_gtkdoc=true",
- "-Ddisable_doc=true"]
- self.run_in_sandbox(*meson_args, exit_on_failure=True,
- cwd=self.topdir)
-
- # Build the buildable parts of Pitivi.
- ninja_args = ["ninja", "-C", "mesonbuild/"]
- self.run_in_sandbox(*ninja_args, exit_on_failure=True,
+ try:
+ subprocess.check_call(["flatpak-builder", "--version"])
+ except FileNotFoundError:
+ Console.message("\n%sYou need to install flatpak-builder%s\n",
+ Colors.FAIL, Colors.ENDC)
+ self.exit(1)
+ subprocess.check_call(builder_args, cwd=self.scriptdir)
+
+ if not os.path.isdir("mesonbuild/"):
+ # Create the build directory.
+ meson_args = ["meson", "mesonbuild/", "--prefix=/app",
+ "--libdir=lib", "-Ddisable_gtkdoc=true",
+ "-Ddisable_doc=true"]
+ self.run_in_sandbox(*meson_args, exit_on_failure=True,
cwd=self.topdir)
- else:
- Console.message("Using Pitivi prefix in %s", self.prefix)
+ # Build the buildable parts of Pitivi.
+ ninja_args = ["ninja", "-C", "mesonbuild/"]
+ self.run_in_sandbox(*ninja_args, exit_on_failure=True,
+ cwd=self.topdir)
+
+ def install_development_tools(self):
venv_path = os.path.join(self.scriptdir, "pyvenv")
- activate_script = os.path.join(venv_path, "bin", "activate")
- pip_modules = "git-phab pre-commit git-pylint-commit-hook git_pep8_commit_hook pylint hotdoc"
+ Console.message("Setting up a Python virtual env for development: %s", venv_path)
if not os.path.isdir(venv_path):
- print("Setting up a Python virtual env for development: %s" % venv_path)
venv.create(venv_path, with_pip=True)
- print("Installing development tools in the Python virtual env: %s" % pip_modules)
- subprocess.check_call(
- ". %s && pip install %s" % (activate_script, pip_modules),
- shell=True)
- if self.update:
- subprocess.check_call(
- ". %s && pip install -U %s" % (activate_script, pip_modules),
- shell=True)
+ activate_script = os.path.join(venv_path, "bin", "activate")
+ pip_modules = "git-phab pre-commit git-pylint-commit-hook git_pep8_commit_hook pylint"
+ Console.message("Installing development tools in the Python virtual env: %s", pip_modules)
+ subprocess.check_call(
+ ". %s && pip install -U %s" % (activate_script, pip_modules),
+ shell=True)
# git-pylint-commit-hook must run pylint in the sandbox so it uses
# the gi Python modules in there. At the same time it also has to be
# installed in the development pyvenv which is outside the sandbox
# because git-pylint-commit-hook needs to import pylint.config.
- if fresh_install or self.update:
- pip_modules = ["pylint"]
- print("Installing development tools in the sandbox: %s" % pip_modules)
- self.run_in_sandbox("pip3", "install", "-U", "--user", *pip_modules,
- exit_on_failure=True)
-
- if not self.check and not self.update:
- self.run_in_sandbox(*self.args, exit_on_failure=True)
+ pip_modules = ["pylint"]
+ Console.message("Installing development tools in the sandbox: %s", pip_modules)
+ self.run_in_sandbox("pip3", "install", "-U", "--user", *pip_modules,
+ exit_on_failure=True)
def run_in_sandbox(self, *args, exit_on_failure=False, cwd=None):
+ if not args:
+ return
+
flatpak_command = ["flatpak", "build", "--socket=x11",
"--socket=session-bus", "--socket=pulseaudio",
"--share=network", "--env=PITIVI_DEVELOPMENT=1",
@@ -604,10 +582,7 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
flatpak_command.append(self.prefix)
- if args:
- flatpak_command.extend(args)
- else:
- flatpak_command.append(os.path.join(self.scriptdir, "enter-env"))
+ flatpak_command.extend(args)
Console.message("Running in sandbox: %s", ' '.join(args))
try:
@@ -616,21 +591,18 @@ class PitiviFlatpak: # pylint: disable=too-many-instance-attributes
if exit_on_failure:
self.exit(e.returncode)
- def install_all(self):
- for m in self.packs:
- if not m.is_installed():
- m.install()
-
- def update_all(self):
- for m in self.packs:
- m.update()
+ def install_flatpak_runtimes(self):
+ for runtime in self.packs:
+ if not runtime.is_installed():
+ runtime.install()
+ else:
+ runtime.update()
if __name__ == "__main__":
app_flatpak = PitiviFlatpak()
- parser = argparse.ArgumentParser(
- prog="pitivi-flatpak")
+ parser = argparse.ArgumentParser(prog="pitivi-flatpak")
general = parser.add_argument_group("General")
general.add_argument("--update", dest="update",
@@ -644,14 +616,9 @@ if __name__ == "__main__":
help="Do not print anything")
general.add_argument("args",
nargs=argparse.REMAINDER,
- help="Arguments passed when starting %s or, if -d is "
- "passed, the command to run" % app_flatpak.name)
+ help="The command to run in the sandbox")
devel = parser.add_argument_group("Development")
- devel.add_argument("-d", "--devel", dest="devel",
- action="store_true",
- help="Setup a devel environment")
-
devel.add_argument("--branch", dest="branch",
help="The flatpak branch to use (stable, master...)",
default="master")
@@ -669,7 +636,6 @@ if __name__ == "__main__":
bundling.add_argument("--bundle", dest="bundle",
action="store_true",
help="Create bundle repository, implies --build")
-
bundling.add_argument(
"--repo-commit-subject", dest="commit_subject", default=None,
help="The commit subject to be used when updating the ostree repository")
diff --git a/docs/Install_with_flatpak.md b/docs/Install_with_flatpak.md
index 7422a2c..b852d54 100644
--- a/docs/Install_with_flatpak.md
+++ b/docs/Install_with_flatpak.md
@@ -11,8 +11,8 @@ bug](Bug_reporting.md).
## Getting Flatpak
-You can get information about how to install flatpak for your
-distribution [here](http://flatpak.org/getting.html).
+See the flatpak website for [how to install flatpak](http://flatpak.org/getting.html)
+for your distribution.
You need to log out/in again after installing flatpak for apps to show
up in menus. Until you log out/in, the flatpak data directories aren't
@@ -25,35 +25,19 @@ To install the latest stable Pitivi release, run as a normal user (no
root nor sudo):
```
- $ flatpak install --user https://flathub.org/repo/appstream/org.pitivi.Pitivi.flatpakref
+$ flatpak install --user https://flathub.org/repo/appstream/org.pitivi.Pitivi.flatpakref
```
-We also provide latest development snapshot toward what is going to become `Pitivi 1.0`, you can install
with:
+To install the latest Pitivi 1.0 development snapshot, run:
```
- $ flatpak install --user http://flatpak.pitivi.org/pitivi.flatpakref
+$ flatpak install --user http://flatpak.pitivi.org/pitivi.flatpakref
```
-### Troubleshooting
-
-If your flatpak version is less than 0.8, you need to run instead:
-
-
-```
-$ flatpak --version
-$ curl https://git.gnome.org/browse/pitivi/plain/build/flatpak/pitivi-flatpak -Sso pitivi-flatpak
-$ chmod +x pitivi-flatpak
-$ ./pitivi-flatpak --branch=stable --update
-```
-When the script finishes installing (or updating), it launches Pitivi.
-
-## Installing Pitivi master (development version)
-
-To install the development version as a separate application called
-“(Rolling) Pitivi”, run in a terminal:
+To install the development version including the latest features, run:
```
-$ flatpak install --user http://flatpak.pitivi.org/pitivi-master.flatpakref
+$ flatpak install --user http://flatpak.pitivi.org/pitivi-master.flatpakref
```
You might want to use Pitivi master to contribute and help us test
@@ -70,13 +54,13 @@ to the latest version.
To see if warning or error messages are printed in the console, run:
```
-$ flatpak run org.pitivi.Pitivi//stable
+$ flatpak run org.pitivi.Pitivi//stable
```
If for some reason you need to use an older Pitivi version, run:
```
-$ flatpak run org.pitivi.Pitivi//0.96`
+$ flatpak run org.pitivi.Pitivi//0.96
```
## Updating Pitivi
@@ -86,7 +70,9 @@ installer the same way as before.
Alternatively, update by using directly flatpak:
-`$ flatpak --user update org.pitivi.Pitivi`
+```
+$ flatpak --user update org.pitivi.Pitivi
+```
If a new version is fetched, it will be made current.
@@ -94,7 +80,9 @@ If a new version is fetched, it will be made current.
If your software manager doesn't allow this yet, run the command below:
-`$ flatpak --user uninstall org.pitivi.Pitivi stable`
+```
+$ flatpak --user uninstall org.pitivi.Pitivi stable
+```
## Install GStreamer vaapi support
@@ -102,4 +90,7 @@ In the sandbox gstreamer-vaapi is installed but it requires the
org.freedesktop.Platform.VAAPI.Intel extension to be installed.
As the support is experimental, you need to set PITIVI_UNSTABLE_FEATURES
-to enable them: `flatpak run --env=PITIVI_UNSTABLE_FEATURES=vaapi org.pitivi.Pitivi`.
+to enable them:
+```
+$ flatpak run --env=PITIVI_UNSTABLE_FEATURES=vaapi org.pitivi.Pitivi
+```
diff --git a/pre-commit.hook b/pre-commit.hook
index 4b0f63a..43a14e1 100755
--- a/pre-commit.hook
+++ b/pre-commit.hook
@@ -85,7 +85,7 @@ echo
export PYTHONPATH=$TOPLEVEL/pitivi/coptimizations/.libs:$PYTHONPATH
-git-pylint-commit-hook --pylint="$TOPLEVEL/build/flatpak/pitivi-flatpak" --pylint-params="-d pylint"
--pylintrc=$RCFILE $IGNORE_ARGS --limit=10.0 --suppress-report || exit 1
+git-pylint-commit-hook --pylint="$TOPLEVEL/build/flatpak/pitivi-flatpak" --pylint-params="pylint"
--pylintrc=$RCFILE $IGNORE_ARGS --limit=10.0 --suppress-report || exit 1
git_pep8_commit_hook --pep8-params="--repeat --ignore=E501,E128" || exit 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]