Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove release force true #36

Merged
merged 8 commits into from
Jan 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 31 additions & 33 deletions .cookiecutterrc
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
# This file exists so you can easily regenerate your project.
#
# Unfortunatelly cookiecutter can't use this right away so
# you have to copy this file to ~/.cookiecutterrc
# Generated by cookiepatcher, a small shim around cookiecutter (pip install cookiepatcher)

default_context:

appveyor: 'yes'
c_extension_optional: 'no'
c_extension_support: 'no'
codacy: 'yes'
codeclimate: 'yes'
codecov: 'yes'
command_line_interface: 'no'
coveralls: 'yes'
distribution_name: 'python-redis-lock'
email: 'contact@ionelmc.ro'
full_name: 'Ionel Cristian Mărieș'
github_username: 'ionelmc'
landscape: 'yes'
package_name: 'redis_lock'
project_name: 'redis-lock'
project_short_description: 'Lock context manager implemented via redis SETNX/BLPOP.'
release_date: '2015-08-19'
repo_name: 'python-redis-lock'
requiresio: 'yes'
scrutinizer: 'yes'
sphinx_theme: 'sphinx-py3doc-enhanced-theme'
test_matrix_configurator: 'yes'
test_runner: 'pytest'
travis: 'yes'
version: '2.2.0'
website: 'http://blog.ionelmc.ro'
year: '2013-2015'
cookiecutter:
appveyor: 'no'
bin_name: nameless
c_extension_cython: 'no'
c_extension_optional: 'no'
c_extension_support: 'no'
codacy: 'yes'
codeclimate: 'yes'
codecov: 'yes'
command_line_interface: 'no'
coveralls: 'yes'
distribution_name: python-redis-lock
email: contact@ionelmc.ro
full_name: Ionel Cristian Mărieș
github_username: ionelmc
landscape: 'yes'
package_name: redis_lock
project_name: redis-lock
project_short_description: Lock context manager implemented via redis SETNX/BLPOP.
release_date: today
repo_name: python-redis-lock
requiresio: 'yes'
scrutinizer: 'yes'
sphinx_theme: sphinx-py3doc-enhanced-theme
test_matrix_configurator: 'yes'
test_runner: pytest
travis: 'yes'
version: 2.2.0
website: http://blog.ionelmc.ro
year: 2013-2015
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# see http://editorconfig.org
root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4
charset = utf-8

[*.{bat,cmd,ps1}]
end_of_line = crlf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ docs/_build
.cache
.pytest
.bootstrap
.appveyor.token
*.bak
15 changes: 13 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
language: python
python: 2.7
python: '3.5'
sudo: false
env:
global:
LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
- SEGFAULT_SIGNALS=all
matrix:
- TOXENV=check

- TOXENV=2.6-1.4,coveralls,codecov
- TOXENV=2.6-1.4-nocover
- TOXENV=2.6-1.5,coveralls,codecov
Expand Down Expand Up @@ -38,6 +40,10 @@ env:
- TOXENV=3.4-1.7-nocover
- TOXENV=3.4-1.8,coveralls,codecov
- TOXENV=3.4-1.8-nocover
- TOXENV=3.5-1.7,coveralls,codecov
- TOXENV=3.5-1.7-nocover
- TOXENV=3.5-1.8,coveralls,codecov
- TOXENV=3.5-1.8-nocover
- TOXENV=pypy-1.4,coveralls,codecov
- TOXENV=pypy-1.4-nocover
- TOXENV=pypy-1.5,coveralls,codecov
Expand All @@ -63,6 +69,11 @@ script:
after_failure:
- more .tox/log/* | cat
- more .tox/*/log/* | cat
before_cache:
- rm -rf $HOME/.cache/pip/log
cache:
directories:
- $HOME/.cache/pip
notifications:
email:
on_success: never
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include .coveragerc
include .cookiecutterrc
include .isort.cfg
include .pylintrc
include .editorconfig

include AUTHORS.rst
include CHANGELOG.rst
Expand Down
16 changes: 8 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
==========
redis-lock
==========
========
Overview
========

.. start-badges

.. list-table::
:stub-columns: 1

* - docs
- |docs|
* - tests
- | |travis| |appveyor| |requires|
- | |travis| |requires|
| |coveralls| |codecov|
| |landscape| |scrutinizer| |codacy| |codeclimate|
* - package
Expand All @@ -22,10 +24,6 @@ redis-lock
:alt: Travis-CI Build Status
:target: https://travis-ci.org/ionelmc/python-redis-lock

.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/ionelmc/python-redis-lock?branch=master&svg=true
:alt: AppVeyor Build Status
:target: https://ci.appveyor.com/project/ionelmc/python-redis-lock

.. |requires| image:: https://requires.io/github/ionelmc/python-redis-lock/requirements.svg?branch=master
:alt: Requirements Status
:target: https://requires.io/github/ionelmc/python-redis-lock/requirements/?branch=master
Expand Down Expand Up @@ -73,6 +71,8 @@ redis-lock
:alt: Scrutinizer Status
:target: https://scrutinizer-ci.com/g/ionelmc/python-redis-lock/

.. end-badges

Lock context manager implemented via redis SETNX/BLPOP.

* Free software: BSD license
Expand Down
4 changes: 4 additions & 0 deletions ci/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@
exec(compile(open(activate, "rb").read(), activate, "exec"), dict(__file__=activate))

import jinja2

import matrix


jinja = jinja2.Environment(
loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")),
trim_blocks=True,
lstrip_blocks=True,
keep_trailing_newline=True
)

tox_environments = {}
for (alias, conf) in matrix.from_file(join(base_path, "setup.cfg")).items():
python = conf["python_versions"]
Expand All @@ -57,6 +60,7 @@
if "environment_variables" in conf:
tox_environments[alias].update(env_vars=env_vars.split())


for name in os.listdir(join("ci", "templates")):
with open(join(base_path, name), "w") as fh:
fh.write(jinja.get_template(name).render(tox_environments=tox_environments))
Expand Down
16 changes: 11 additions & 5 deletions ci/templates/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
language: python
python: 2.7
python: '3.5'
sudo: false
env:
global:
LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
- SEGFAULT_SIGNALS=all
matrix:
- TOXENV=check
{% for env, config in tox_environments|dictsort %}
- TOXENV={{ env }}{% if config.cover %},coveralls,codecov{% endif %}

{% for env, config in tox_environments|dictsort %}{{ '' }}
- TOXENV={{ env }}{% if config.cover %},coveralls,codecov{% endif -%}
{% endfor %}

before_install:
- python --version
- uname -a
Expand All @@ -25,6 +26,11 @@ script:
after_failure:
- more .tox/log/* | cat
- more .tox/*/log/* | cat
before_cache:
- rm -rf $HOME/.cache/pip/log
cache:
directories:
- $HOME/.cache/pip
notifications:
email:
on_success: never
Expand Down
11 changes: 6 additions & 5 deletions ci/templates/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ envlist =
docs

[testenv]
basepython =
{docs,spell}: python2.7
{clean,check,report,extension-coveralls,coveralls,codecov}: python3.5
setenv =
PYTHONPATH={toxinidir}/tests
PYTHONUNBUFFERED=yes
Expand All @@ -28,7 +31,7 @@ setenv =
commands =
sphinx-build -b spelling docs dist/docs
skip_install = true
usedevelop = true
usedevelop = false
deps =
-r{toxinidir}/docs/requirements.txt
sphinxcontrib-spelling
Expand All @@ -53,19 +56,18 @@ passenv =
*

[testenv:check]
basepython = python3.4
deps =
docutils
check-manifest
flake8
readme
readme-renderer
pygments
skip_install = true
usedevelop = false
commands =
python setup.py check --strict --metadata --restructuredtext
check-manifest {toxinidir}
flake8 src tests
flake8 src tests setup.py

[testenv:coveralls]
deps =
Expand All @@ -90,7 +92,6 @@ commands =


[testenv:report]
basepython = python3.4
deps = coverage
skip_install = true
usedevelop = false
Expand Down
16 changes: 13 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinxcontrib.napoleon'
'sphinx.ext.napoleon',
'sphinx.ext.extlinks',
]
if os.getenv('SPELLCHECK'):
extensions += 'sphinxcontrib.spelling',
Expand All @@ -25,19 +26,28 @@
author = 'Ionel Cristian Mărieș'
copyright = '{0}, {1}'.format(year, author)
version = release = '2.3.0'

pygments_style = 'trac'
templates_path = ['.']
extlinks = {
'issue': ('https://github.com/ionelmc/python-redis-lock/issues/%s', '#'),
'pr': ('https://github.com/ionelmc/python-redis-lock/pull/%s', 'PR #'),
}
import sphinx_py3doc_enhanced_theme
html_theme = "sphinx_py3doc_enhanced_theme"
html_theme_path = [sphinx_py3doc_enhanced_theme.get_html_theme_path()]
html_theme_options = {
'githuburl': 'https://github.com/ionelmc/python-redis-lock/'
}

pygments_style = 'trac'
templates_path = ['.']
html_use_smartypants = True
html_last_updated_fmt = '%b %d, %Y'
html_split_index = True
html_sidebars = {
'**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'],
}
html_short_title = '%s-%s' % (project, version)

napoleon_use_ivar = True
napoleon_use_rtype = False
napoleon_use_param = False
7 changes: 3 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
Welcome to redis-lock's documentation!
========================================

Contents:
========
Contents
========

.. toctree::
:maxdepth: 2
Expand Down
4 changes: 0 additions & 4 deletions docs/readme.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
########
Overview
########

.. include:: ../README.rst
3 changes: 1 addition & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
sphinx
sphinxcontrib-napoleon
sphinx>=1.3
sphinx-py3doc-enhanced-theme
-e .
16 changes: 6 additions & 10 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,9 @@ The above example could be rewritten using context manager::
time.sleep(5)

In cases, where lock not necessarily in acquired state, and
user need to ensure, that it's released, ``force`` parameter could be used::

lock = Lock(conn, "foo")
try:
if lock.acquire(block=False):
print("Got the lock. Do crazy dance")
else:
print("Didn't get the lock. Do normal dance")
finally:
lock.release(force=True)
user need to ensure, that it has a matching ``id``, example::

lock1 = Lock(conn, "foo")
lock1.acquire()
lock2 = Lock(conn, "foo", id=lock1.id)
lock2.release()
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ python_versions =
2.7
3.3
3.4
3.5
pypy

dependencies =
Expand All @@ -73,8 +74,8 @@ dependencies =
1.6: redis==2.10.3 &python_versions[2.6]

1.4: django-redis==3.8.4 redis==2.10.3 Django==1.4.22 !python_versions[3.*] !python_versions[2.6]
1.5: django-redis==3.8.4 redis==2.10.3 Django==1.5.12 !python_versions[2.6]
1.6: django-redis==3.8.4 redis==2.10.3 Django==1.6.11 !python_versions[2.6]
1.5: django-redis==3.8.4 redis==2.10.3 Django==1.5.12 !python_versions[2.6] !python_versions[3.5]
1.6: django-redis==3.8.4 redis==2.10.3 Django==1.6.11 !python_versions[2.6] !python_versions[3.5]

1.7: django-redis==3.8.4 redis==2.10.3 Django==1.7.10 !python_versions[2.6]
1.8: django-redis==4.2.0 redis==2.10.3 Django==1.8.4 !python_versions[2.6]
Expand Down
Loading