[pitivi] Use `pre-commit` as a pre commit hook
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Use `pre-commit` as a pre commit hook
- Date: Thu, 7 Apr 2016 12:41:01 +0000 (UTC)
commit 02229e324510c9a8d862d7b732fe089c77aa1d0f
Author: Thibault Saunier <tsaunier gnome org>
Date: Thu Apr 7 09:32:53 2016 +0200
Use `pre-commit` as a pre commit hook
.pre-commit-config.yaml | 21 +++++++++++++++++++++
autogen.sh | 15 +++++++++++----
build/xdg-app/pitivi.template.json | 13 +++++++++++++
build/xdg-app/pre-commit-configure | 12 ++++++++++++
4 files changed, 57 insertions(+), 4 deletions(-)
---
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..cab96d1
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,21 @@
+- repo: https://github.com/pre-commit/pre-commit-hooks.git
+ sha: ff65d01841ad012d0a9aa1dc451fc4539d8b7baf
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-json
+ - id: autopep8-wrapper
+ files: ^git-phab$
+ - id: check-docstring-first
+ - id: debug-statements
+ - id: flake8
+ files: .*\.py$\|bin/pitivi.in
+- repo: https://github.com/pre-commit/pre-commit.git
+ sha: 495e21b24dfc73624c8c7a16bf974da54e3217e7
+ hooks:
+ - id: validate_config
+ - id: validate_manifest
+- repo: https://github.com/asottile/reorder_python_imports.git
+ sha: 017e2f64306853ec7f000db52b8280da27eb3b96
+ hooks:
+ - id: reorder-python-imports
diff --git a/autogen.sh b/autogen.sh
index 8a82162..13a9fa9 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -47,12 +47,19 @@ autoheader_check || DIE=1
die_check $DIE
# install pre-commit hook for doing clean commits
-if test ! \( -x .git/hooks/pre-commit -a -L .git/hooks/pre-commit \);
-then
- rm -f .git/hooks/pre-commit
- ln -s ../../pre-commit.hook .git/hooks/pre-commit
+rm -f .git/hooks/pre-commit
+ln -s ../../pre-commit.hook .git/hooks/pre-commit
+
+which pre-commit
+PRE_COMMIT=$?
+if ((PRE_COMMIT != 0)); then
+ echo "Please install pre-commit from http://pre-commit.com/ and try again"
+ exit 1
+else
+ pre-commit install
fi
+
# if no arguments specified then this will be printed
if test -z "$*"; then
echo "+ checking for autogen.sh options"
diff --git a/build/xdg-app/pitivi.template.json b/build/xdg-app/pitivi.template.json
index db8e5fd..47a4db4 100644
--- a/build/xdg-app/pitivi.template.json
+++ b/build/xdg-app/pitivi.template.json
@@ -103,6 +103,19 @@
]
},
{
+ "name": "pre-commit",
+ "build-options" : {
+ "build-args": ["--share=network"]
+ },
+ "sources": [
+ {
+ "type": "file",
+ "path": "pre-commit-configure",
+ "dest-filename": "configure"
+ }
+ ]
+ },
+ {
"name": "matplotlib",
"build-options" : {
"build-args": ["--share=network"]
diff --git a/build/xdg-app/pre-commit-configure b/build/xdg-app/pre-commit-configure
new file mode 100755
index 0000000..58c226e
--- /dev/null
+++ b/build/xdg-app/pre-commit-configure
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+FLAGS="$@"
+
+cat <<EOF > Makefile
+all:
+ echo "Nothing"
+
+install:
+ pip3 install -v --install-option="--prefix=/app/" pre-commit
+
+EOF
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]