Skip to content

Commit

Permalink
Merge branch 'release/1.0'
Browse files Browse the repository at this point in the history
* release/1.0:
  fixes some typos
  moves requirements into setup.py
  add sphinx to dev requirements
  fixes packaging
  updates travis config
  updates coverage config
  updates travis config
  updates travis config
  updates travis config
  move to codecov
  add django 1.9 stable tests
  Add Gitter badge
  • Loading branch information
saxix committed Dec 15, 2015
2 parents 227cbfe + da452bc commit c7c2cbc
Show file tree
Hide file tree
Showing 13 changed files with 100 additions and 138 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ env:
# - TOXENV=py35-d19-sqlite

install:
- pip install tox coverage coveralls>=0.5
- pip install tox coverage python-coveralls>=2.5 coveralls>=0.5 codecov

script:
- tox -e $TOXENV --recreate -- -vv --capture=no --cov=concurrency --cov-report=xml --cov-config=tests/.coveragerc
- tox -e $TOXENV -- tests -vv --capture=no --cov=concurrency --cov-report=xml --cov-config=tests/.coveragerc

before_success:
- coverage erase

after_success:
- coverage combine
- coveralls

- codecov
10 changes: 5 additions & 5 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Release 1.0
-----------
* **BACKWARD INCOMPATIBLE**:: dropped support for django prior 1.6
* **BACKWARD INCOMPATIBLE**:: dropped support for Django prior 1.6
* code clean
* fixes :issue:`54` (thanks vmspike).
* fixes :issue:`53`. updates Documentation
Expand All @@ -16,11 +16,11 @@ Release 1.0

Release 0.9
-----------
* django 1.8 compatibility
* Django 1.8 compatibility
* python 3.4 compatibility
* **BACKWARD INCOMPATIBLE** :function:`disable_concurrency` works differently if used with classes or instances
* better support for external Models (models that are part of plugged-in applications)
* fixes issue with TriggerVersioField and Proxy Models (thanx Richard Eames)
* fixes issue with TriggerVersionField and Proxy Models (thanx Richard Eames)


Release 0.8.1
Expand All @@ -30,7 +30,7 @@ Release 0.8.1

Release 0.8
-----------
* django 1.7 compatibility
* Django 1.7 compatibility
* fixes typo in ``delete_selected_confirmation.html`` template
* python 3.2/3.3 compatibility

Expand Down Expand Up @@ -77,7 +77,7 @@ Release 0.4.0
* added :setting:`CONCURRECY_SANITY_CHECK` settings entry
* signing of version number to avoid tampering (:ref:`concurrentform`)
* added :ref:`concurrencytestmixin` to help test on concurrency managed models
* changed way to add concurrency to exisiting models (:ref:`apply_concurrency_check`)
* changed way to add concurrency to existing models (:ref:`apply_concurrency_check`)
* fixed :issue:`4` (thanks FrankBie)
* removed RandomVersionField
* new :ref:`concurrency_check`
Expand Down
28 changes: 11 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,29 @@ VERSION=2.0.0
BUILDDIR='~build'
PYTHONPATH:=${PWD}/tests/:${PWD}
DBENGINE?=pg
DJANGO?='1.7.x'
DJANGO?='last'


mkbuilddir:
.mkbuilddir:
mkdir -p ${BUILDDIR}

install-deps:
@pip install "pip>=6.0.8"
@pip install -qr requirements/tests.pip
develop:
@pip install -U pip setuptools
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then pip install MySQL-python; fi"
@sh -c "if [ '${DBENGINE}' = 'pg' ]; then pip install -q psycopg2; fi"
@sh -c "if [ '${DJANGO}' = '1.4.x' ]; then pip install 'django>=1.4,<1.5'; fi"
@sh -c "if [ '${DJANGO}' = '1.5.x' ]; then pip install 'django>=1.5,<1.6'; fi"
@sh -c "if [ '${DJANGO}' = '1.6.x' ]; then pip install 'django>=1.6,<1.7'; fi"
@sh -c "if [ '${DJANGO}' = '1.7.x' ]; then pip install 'django>=1.7,<1.8'; fi"
@sh -c "if [ '${DJANGO}' = '1.8.x' ]; then pip install 'django>=1.8,<1.9'; fi"
@sh -c "if [ '${DJANGO}' = '1.9.x' ]; then pip install 'django>=1.9,<1.10'; fi"
@sh -c "if [ '${DJANGO}' = 'last' ]; then pip install django; fi"
@sh -c "if [ '${DJANGO}' = 'dev' ]; then pip install git+git://github.com/django/django.git; fi"
@pip install -e .[dev]
$(MAKE) .init-db


init-db:
.init-db:
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -u root -e 'DROP DATABASE IF EXISTS concurrency;'; fi"
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE IF NOT EXISTS concurrency;'; fi"

Expand All @@ -31,16 +34,8 @@ init-db:
test:
py.test -v


ci: mkbuilddir install-deps init-db
$(MAKE) coverage

coverage:
PYTHONPATH=${PWD}/tests/:${PWD} py.test tests -v --cov=concurrency --cov-report=html --cov-config=tests/.coveragerc -q


clean:
rm -fr ${BUILDDIR} dist *.egg-info .coverage
rm -fr ${BUILDDIR} dist *.egg-info .coverage coverage.xml
find src -name __pycache__ -o -name "*.py?" -o -name "*.orig" -prune | xargs rm -rf
find src/concurrency/locale -name django.mo | xargs rm -f

Expand All @@ -49,10 +44,9 @@ fullclean:
$(MAKE) clean


docs: mkbuilddir
docs: .mkbuilddir
mkdir -p ${BUILDDIR}/docs
sphinx-build -aE docs/ ${BUILDDIR}/docs
ifdef BROWSE
firefox ${BUILDDIR}/docs/index.html
endif

25 changes: 5 additions & 20 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@ Django Concurrency
==================


.. image:: https://pypip.in/v/django-concurrency/badge.png
:target: https://crate.io/packages/django-concurrency/

.. image:: https://pypip.in/d/django-concurrency/badge.png
:target: https://crate.io/packages/django-concurrency/


django-concurrency is an optimistic lock [1]_ implementation for Django.

Supported Django versions: 1.7.x 1.8.x, 1.9rc1.
Expand Down Expand Up @@ -74,23 +67,15 @@ Links
.. |master-build| image:: https://secure.travis-ci.org/saxix/django-concurrency.png?branch=master
:target: http://travis-ci.org/saxix/django-concurrency/

.. |master-cov| image:: https://img.shields.io/coveralls/saxix/django-concurrency/master.svg
:target: https://coveralls.io/r/saxix/django-concurrency

.. |master-req| image:: https://requires.io/github/saxix/django-concurrency/requirements.png?branch=master
:target: https://requires.io/github/saxix/django-concurrency/requirements/?branch=master
:alt: Requirements Status

.. |master-cov| image:: https://codecov.io/github/saxix/django-concurrency/coverage.svg?branch=master
:target: https://codecov.io/github/saxix/django-concurrency?branch=master

.. |dev-build| image:: https://secure.travis-ci.org/saxix/django-concurrency.png?branch=develop
:target: http://travis-ci.org/saxix/django-concurrency/

.. |dev-cov| image:: https://img.shields.io/coveralls/saxix/django-concurrency/develop.svg
:target: https://coveralls.io/r/saxix/django-concurrency
.. |dev-cov| image:: https://codecov.io/github/saxix/django-concurrency/coverage.svg?branch=develop
:target: https://codecov.io/github/saxix/django-concurrency?branch=develop

.. |dev-req| image:: https://requires.io/github/saxix/django-concurrency/requirements.png?branch=develop
:target: https://requires.io/github/saxix/django-concurrency/requirements/?branch=develop
:alt: Requirements Status

.. |wheel| image:: https://pypip.in/wheel/blackhole/badge.png

Expand All @@ -112,4 +97,4 @@ _list-editable: https://django-concurrency.readthedocs.org/en/latest/admin.html#
.. image:: https://badges.gitter.im/Join%20Chat.svg
:alt: Join the chat at https://gitter.im/saxix/django-concurrency
:target: https://gitter.im/saxix/django-concurrency?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
:target: https://gitter.im/saxix/django-concurrency?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
import os, sys
here = os.path.abspath(os.path.join(os.path.dirname(__file__)))
here = os.path.abspath(os.path.join(os.path.dirname(__file__)))
rel = lambda *args: os.path.join(here, *args)

sys.path.insert(0, rel(os.pardir))
Expand Down
8 changes: 0 additions & 8 deletions requirements/develop.pip

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/docs.pip

This file was deleted.

11 changes: 0 additions & 11 deletions requirements/tests.pip

This file was deleted.

3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,CONCURRENCY,LOCALFOLDER
max-complexity = 12
max-line-length = 160
exclude = .tox,migrations,.git,docs,diff_match_patch.py, deploy/**,settings
ignore = E501,E401,W391,E128,E261
ignore = E501,E401,W391,E128,E261,D

[pytest]
python_paths=./tests/demoapp/
Expand All @@ -36,4 +36,3 @@ addopts =
pep8ignore = * ALL
markers =
functional: mark a test as functional

120 changes: 60 additions & 60 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,73 +1,23 @@
#!/usr/bin/env python
import os
import sys
import subprocess
import datetime
from setuptools import setup, find_packages
from distutils import log
from distutils.command.clean import clean as CleanCommand
from distutils.dir_util import remove_tree

from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand

ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__)))
sys.path.append(os.path.join(ROOT, 'src'))
from concurrency import VERSION

NAME = 'django-concurrency'


def get_version(version):
"""Derives a PEP386-compliant version number from VERSION."""
assert len(version) == 5
assert version[3] in ('alpha', 'beta', 'rc', 'final')

parts = 2 if version[2] == 0 else 3
main = '.'.join(str(x) for x in version[:parts])

sub = ''
if version[3] == 'alpha' and version[4] == 0:
git_changeset = get_git_changeset()
if git_changeset:
sub = '.a%s' % git_changeset

elif version[3] != 'final':
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
sub = mapping[version[3]]
if version[4] > 0:
sub += str(version[4])

return main + sub


def get_git_changeset():
"""Returns a numeric identifier of the latest git changeset.
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
This value isn't guaranteed to be unique, but collisions are very unlikely,
so it's sufficient for generating the development version numbers.
"""
repo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
git_log = subprocess.Popen('git log --pretty=format:%ct --quiet -1 HEAD',
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
shell=True, cwd=repo_dir,
universal_newlines=True)
timestamp = git_log.communicate()[0]
try:
timestamp = datetime.datetime.utcfromtimestamp(int(timestamp))
except ValueError:
return None
return timestamp.strftime('%Y%m%d%H%M%S')


RELEASE = get_version(VERSION)
app = __import__('concurrency')
base_url = 'https://github.com/saxix/django-concurrency/'
VERSIONMAP = {'final': (VERSION, 'Development Status :: 5 - Production/Stable'),
'rc': (VERSION, 'Development Status :: 4 - Beta'),
'beta': (VERSION, 'Development Status :: 4 - Beta'),
'alpha': ('master', 'Development Status :: 3 - Alpha')}

download_tag, development_status = VERSIONMAP[VERSION[3]]
install_requires = []


class PyTest(TestCommand):

def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ['tests']
Expand All @@ -82,9 +32,56 @@ def run_tests(self):
sys.exit(errno)


class Clean(CleanCommand):
user_options = CleanCommand.user_options + [
('build-coverage=', 'c',
"build directory for coverage output (default: 'build.build-coverage')"),
]

def initialize_options(self):
self.build_coverage = None
self.build_help = None
CleanCommand.initialize_options(self)

def run(self):
if self.all:
for directory in (os.path.join(self.build_base, 'coverage'),
os.path.join(self.build_base, 'help')):
if os.path.exists(directory):
remove_tree(directory, dry_run=self.dry_run)
else:
log.warn("'%s' does not exist -- can't clean it",
directory)
if self.build_coverage:
remove_tree(self.build_coverage, dry_run=self.dry_run)
if self.build_help:
remove_tree(self.build_help, dry_run=self.dry_run)
CleanCommand.run(self)

install_requires = ["django"]
test_requires = ["django-webtest>=1.7.5",
"mock>=1.0.1",
"pytest-cache>=1.0",
"pytest-cov>=1.6",
"pytest-django>=2.8",
"pytest-echo>=1.3",
"pytest-pythonpath",
"pytest>=2.8",
"tox>=2.3",
"WebTest>=2.0.11"]

dev_requires = ["autopep8",
"coverage",
"django_extensions",
"flake8",
"ipython",
"pdbpp",
"psycopg2",
"sphinx"]

setup(
name=NAME,
version=RELEASE,
name=app.NAME,
version=app.get_version(),
url='https://github.com/saxix/django-concurrency',
author='Stefano Apostolico',
author_email='s.apostolico@gmail.com',
Expand All @@ -96,9 +93,12 @@ def run_tests(self):
license='MIT License',
keywords='django',
install_requires=install_requires,
tests_require=test_requires,
extras_require={'test': test_requires,
'dev': test_requires + dev_requires},
cmdclass={'test': PyTest},
classifiers=[
development_status,
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
Expand Down
3 changes: 2 additions & 1 deletion src/concurrency/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import subprocess
import datetime
import os
__author__ = 'sax'
default_app_config = 'concurrency.apps.ConcurrencyConfig'

VERSION = __version__ = (1, 0, 0, 'final', 0)
__author__ = 'sax'
NAME = 'django-concurrency'


def get_version(version=None):
Expand Down
6 changes: 3 additions & 3 deletions tests/.coveragerc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[run]
branch = False
branch = 1
source = concurrency
include =

omit = **/concurrency/__init__.py
omit = src/concurrency/__init__.py
tests/**

[report]
# Regexes for lines to exclude from consideration
Expand Down

0 comments on commit c7c2cbc

Please sign in to comment.