mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Add autopep8 git commit hook (#671)
* Add autopep git hook * Fix broken link
This commit is contained in:
parent
e2583ededf
commit
9314a93d67
4 changed files with 23 additions and 16 deletions
17
Makefile
17
Makefile
|
|
@ -16,7 +16,8 @@ export DETERMINISTIC_TESTS := false
|
||||||
export ETESYNC_TESTS := false
|
export ETESYNC_TESTS := false
|
||||||
|
|
||||||
# Assume to run in Travis. Don't use this outside of a virtual machine. It will
|
# Assume to run in Travis. Don't use this outside of a virtual machine. It will
|
||||||
# heavily "pollute" your system.
|
# heavily "pollute" your system, such as attempting to install a new Python
|
||||||
|
# systemwide.
|
||||||
export CI := false
|
export CI := false
|
||||||
|
|
||||||
# Whether to generate coverage data while running tests.
|
# Whether to generate coverage data while running tests.
|
||||||
|
|
@ -79,7 +80,7 @@ install-test: install-servers
|
||||||
[ -z "$(TEST_EXTRA_PACKAGES)" ] || pip install $(TEST_EXTRA_PACKAGES)
|
[ -z "$(TEST_EXTRA_PACKAGES)" ] || pip install $(TEST_EXTRA_PACKAGES)
|
||||||
|
|
||||||
install-style: install-docs
|
install-style: install-docs
|
||||||
pip install flake8 flake8-import-order flake8-bugbear>=17.3.0
|
pip install flake8 flake8-import-order 'flake8-bugbear>=17.3.0' autopep8
|
||||||
|
|
||||||
style:
|
style:
|
||||||
flake8
|
flake8
|
||||||
|
|
@ -97,9 +98,6 @@ install-docs:
|
||||||
docs:
|
docs:
|
||||||
cd docs && make html
|
cd docs && make html
|
||||||
|
|
||||||
sh: # open subshell with default test config
|
|
||||||
$$SHELL;
|
|
||||||
|
|
||||||
linkcheck:
|
linkcheck:
|
||||||
sphinx-build -W -b linkcheck ./docs/ ./docs/_build/linkcheck/
|
sphinx-build -W -b linkcheck ./docs/ ./docs/_build/linkcheck/
|
||||||
|
|
||||||
|
|
@ -113,7 +111,7 @@ release-deb:
|
||||||
sh scripts/release-deb.sh ubuntu xenial
|
sh scripts/release-deb.sh ubuntu xenial
|
||||||
sh scripts/release-deb.sh ubuntu zesty
|
sh scripts/release-deb.sh ubuntu zesty
|
||||||
|
|
||||||
install-dev:
|
install-dev: install-git-hooks
|
||||||
pip install -e .
|
pip install -e .
|
||||||
[ "$(ETESYNC_TESTS)" = "false" ] || pip install -e .[etesync]
|
[ "$(ETESYNC_TESTS)" = "false" ] || pip install -e .[etesync]
|
||||||
set -xe && if [ "$(REQUIREMENTS)" = "devel" ]; then \
|
set -xe && if [ "$(REQUIREMENTS)" = "devel" ]; then \
|
||||||
|
|
@ -124,6 +122,13 @@ install-dev:
|
||||||
pip install -U --force-reinstall $$(python setup.py --quiet minimal_requirements); \
|
pip install -U --force-reinstall $$(python setup.py --quiet minimal_requirements); \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
install-git-hooks: install-style
|
||||||
|
echo "make style-autocorrect" > .git/hooks/pre-commit
|
||||||
|
chmod +x .git/hooks/pre-commit
|
||||||
|
|
||||||
|
style-autocorrect:
|
||||||
|
git diff --cached --name-only | egrep '\.py$$' | xargs --no-run-if-empty autopep8 -ri
|
||||||
|
|
||||||
ssh-submodule-urls:
|
ssh-submodule-urls:
|
||||||
git submodule foreach "\
|
git submodule foreach "\
|
||||||
echo -n 'Old: '; \
|
echo -n 'Old: '; \
|
||||||
|
|
|
||||||
|
|
@ -174,9 +174,8 @@ To use this storage type, you need to install some additional dependencies::
|
||||||
pip install vdirsyncer[google]
|
pip install vdirsyncer[google]
|
||||||
|
|
||||||
Furthermore you need to register vdirsyncer as an application yourself to
|
Furthermore you need to register vdirsyncer as an application yourself to
|
||||||
obtain ``client_id`` and ``client_secret``, as `it is against Google's Terms of
|
obtain ``client_id`` and ``client_secret``, as it is against Google's Terms of
|
||||||
Service to hardcode those into opensource software
|
Service to hardcode those into opensource software [googleterms]_:
|
||||||
<https://developers.google.com/terms/?hl=th#b-confidential-matters>`_:
|
|
||||||
|
|
||||||
1. Go to the `Google API Manager <https://console.developers.google.com>`_ and
|
1. Go to the `Google API Manager <https://console.developers.google.com>`_ and
|
||||||
create a new project under any name.
|
create a new project under any name.
|
||||||
|
|
@ -198,6 +197,9 @@ The ``token_file`` parameter should be a filepath where vdirsyncer can later
|
||||||
store authentication-related data. You do not need to create the file itself
|
store authentication-related data. You do not need to create the file itself
|
||||||
or write anything to it.
|
or write anything to it.
|
||||||
|
|
||||||
|
.. [googleterms] See `ToS <https://developers.google.com/terms/?hl=th>`_,
|
||||||
|
section "Confidential Matters".
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
You need to configure which calendars Google should offer vdirsyncer using
|
You need to configure which calendars Google should offer vdirsyncer using
|
||||||
|
|
|
||||||
|
|
@ -79,13 +79,13 @@ For many patches, it might suffice to just let Travis run the tests. However,
|
||||||
Travis is slow, so you might want to run them locally too. For this, set up a
|
Travis is slow, so you might want to run them locally too. For this, set up a
|
||||||
virtualenv_ and run this inside of it::
|
virtualenv_ and run this inside of it::
|
||||||
|
|
||||||
# install vdirsyncer from the repo into the virtualenv. Prerequisite for
|
# install:
|
||||||
# most other tasks.
|
# - vdirsyncer from the repo into the virtualenv
|
||||||
|
# - stylecheckers (flake8) and code formatters (autopep8)
|
||||||
|
# - git commit hook for autopep8
|
||||||
make install-dev
|
make install-dev
|
||||||
|
|
||||||
make install-test # install test dependencies
|
make install-test # install test dependencies
|
||||||
make install-style # install dependencies for stylechecking
|
|
||||||
make install-docs # install dependencies for building documentation
|
|
||||||
|
|
||||||
Then you can run::
|
Then you can run::
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ from vdirsyncer.vobject import Item
|
||||||
from .. import StorageTests, get_server_mixin
|
from .. import StorageTests, get_server_mixin
|
||||||
|
|
||||||
|
|
||||||
dav_server = os.environ['DAV_SERVER']
|
dav_server = os.environ.get('DAV_SERVER', 'skip')
|
||||||
ServerMixin = get_server_mixin(dav_server)
|
ServerMixin = get_server_mixin(dav_server)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue