Skip to content

Commit c7c2cbc

Browse files
committed
Merge branch 'release/1.0'
* 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
2 parents 227cbfe + da452bc commit c7c2cbc

File tree

13 files changed

+100
-138
lines changed

13 files changed

+100
-138
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ env:
4242
# - TOXENV=py35-d19-sqlite
4343

4444
install:
45-
- pip install tox coverage coveralls>=0.5
45+
- pip install tox coverage python-coveralls>=2.5 coveralls>=0.5 codecov
4646

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

5050
before_success:
5151
- coverage erase
5252

5353
after_success:
5454
- coverage combine
5555
- coveralls
56-
56+
- codecov

CHANGES

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Release 1.0
22
-----------
3-
* **BACKWARD INCOMPATIBLE**:: dropped support for django prior 1.6
3+
* **BACKWARD INCOMPATIBLE**:: dropped support for Django prior 1.6
44
* code clean
55
* fixes :issue:`54` (thanks vmspike).
66
* fixes :issue:`53`. updates Documentation
@@ -16,11 +16,11 @@ Release 1.0
1616

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

2525

2626
Release 0.8.1
@@ -30,7 +30,7 @@ Release 0.8.1
3030

3131
Release 0.8
3232
-----------
33-
* django 1.7 compatibility
33+
* Django 1.7 compatibility
3434
* fixes typo in ``delete_selected_confirmation.html`` template
3535
* python 3.2/3.3 compatibility
3636

@@ -77,7 +77,7 @@ Release 0.4.0
7777
* added :setting:`CONCURRECY_SANITY_CHECK` settings entry
7878
* signing of version number to avoid tampering (:ref:`concurrentform`)
7979
* added :ref:`concurrencytestmixin` to help test on concurrency managed models
80-
* changed way to add concurrency to exisiting models (:ref:`apply_concurrency_check`)
80+
* changed way to add concurrency to existing models (:ref:`apply_concurrency_check`)
8181
* fixed :issue:`4` (thanks FrankBie)
8282
* removed RandomVersionField
8383
* new :ref:`concurrency_check`

Makefile

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,29 @@ VERSION=2.0.0
22
BUILDDIR='~build'
33
PYTHONPATH:=${PWD}/tests/:${PWD}
44
DBENGINE?=pg
5-
DJANGO?='1.7.x'
5+
DJANGO?='last'
66

77

8-
mkbuilddir:
8+
.mkbuilddir:
99
mkdir -p ${BUILDDIR}
1010

11-
install-deps:
12-
@pip install "pip>=6.0.8"
13-
@pip install -qr requirements/tests.pip
11+
develop:
12+
@pip install -U pip setuptools
1413
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then pip install MySQL-python; fi"
1514
@sh -c "if [ '${DBENGINE}' = 'pg' ]; then pip install -q psycopg2; fi"
1615
@sh -c "if [ '${DJANGO}' = '1.4.x' ]; then pip install 'django>=1.4,<1.5'; fi"
1716
@sh -c "if [ '${DJANGO}' = '1.5.x' ]; then pip install 'django>=1.5,<1.6'; fi"
1817
@sh -c "if [ '${DJANGO}' = '1.6.x' ]; then pip install 'django>=1.6,<1.7'; fi"
1918
@sh -c "if [ '${DJANGO}' = '1.7.x' ]; then pip install 'django>=1.7,<1.8'; fi"
2019
@sh -c "if [ '${DJANGO}' = '1.8.x' ]; then pip install 'django>=1.8,<1.9'; fi"
20+
@sh -c "if [ '${DJANGO}' = '1.9.x' ]; then pip install 'django>=1.9,<1.10'; fi"
21+
@sh -c "if [ '${DJANGO}' = 'last' ]; then pip install django; fi"
2122
@sh -c "if [ '${DJANGO}' = 'dev' ]; then pip install git+git://github.com/django/django.git; fi"
23+
@pip install -e .[dev]
24+
$(MAKE) .init-db
2225

2326

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

@@ -31,16 +34,8 @@ init-db:
3134
test:
3235
py.test -v
3336

34-
35-
ci: mkbuilddir install-deps init-db
36-
$(MAKE) coverage
37-
38-
coverage:
39-
PYTHONPATH=${PWD}/tests/:${PWD} py.test tests -v --cov=concurrency --cov-report=html --cov-config=tests/.coveragerc -q
40-
41-
4237
clean:
43-
rm -fr ${BUILDDIR} dist *.egg-info .coverage
38+
rm -fr ${BUILDDIR} dist *.egg-info .coverage coverage.xml
4439
find src -name __pycache__ -o -name "*.py?" -o -name "*.orig" -prune | xargs rm -rf
4540
find src/concurrency/locale -name django.mo | xargs rm -f
4641

@@ -49,10 +44,9 @@ fullclean:
4944
$(MAKE) clean
5045

5146

52-
docs: mkbuilddir
47+
docs: .mkbuilddir
5348
mkdir -p ${BUILDDIR}/docs
5449
sphinx-build -aE docs/ ${BUILDDIR}/docs
5550
ifdef BROWSE
5651
firefox ${BUILDDIR}/docs/index.html
5752
endif
58-

README.rst

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@ Django Concurrency
33
==================
44

55

6-
.. image:: https://pypip.in/v/django-concurrency/badge.png
7-
:target: https://crate.io/packages/django-concurrency/
8-
9-
.. image:: https://pypip.in/d/django-concurrency/badge.png
10-
:target: https://crate.io/packages/django-concurrency/
11-
12-
136
django-concurrency is an optimistic lock [1]_ implementation for Django.
147

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

77-
.. |master-cov| image:: https://img.shields.io/coveralls/saxix/django-concurrency/master.svg
78-
:target: https://coveralls.io/r/saxix/django-concurrency
79-
80-
.. |master-req| image:: https://requires.io/github/saxix/django-concurrency/requirements.png?branch=master
81-
:target: https://requires.io/github/saxix/django-concurrency/requirements/?branch=master
82-
:alt: Requirements Status
83-
70+
.. |master-cov| image:: https://codecov.io/github/saxix/django-concurrency/coverage.svg?branch=master
71+
:target: https://codecov.io/github/saxix/django-concurrency?branch=master
8472

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

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

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

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

@@ -112,4 +97,4 @@ _list-editable: https://django-concurrency.readthedocs.org/en/latest/admin.html#
11297
11398
.. image:: https://badges.gitter.im/Join%20Chat.svg
11499
:alt: Join the chat at https://gitter.im/saxix/django-concurrency
115-
:target: https://gitter.im/saxix/django-concurrency?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
100+
:target: https://gitter.im/saxix/django-concurrency?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

manage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
import os, sys
3-
here = os.path.abspath(os.path.join(os.path.dirname(__file__)))
3+
here = os.path.abspath(os.path.join(os.path.dirname(__file__)))
44
rel = lambda *args: os.path.join(here, *args)
55

66
sys.path.insert(0, rel(os.pardir))

requirements/develop.pip

Lines changed: 0 additions & 8 deletions
This file was deleted.

requirements/docs.pip

Lines changed: 0 additions & 2 deletions
This file was deleted.

requirements/tests.pip

Lines changed: 0 additions & 11 deletions
This file was deleted.

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,CONCURRENCY,LOCALFOLDER
1717
max-complexity = 12
1818
max-line-length = 160
1919
exclude = .tox,migrations,.git,docs,diff_match_patch.py, deploy/**,settings
20-
ignore = E501,E401,W391,E128,E261
20+
ignore = E501,E401,W391,E128,E261,D
2121

2222
[pytest]
2323
python_paths=./tests/demoapp/
@@ -36,4 +36,3 @@ addopts =
3636
pep8ignore = * ALL
3737
markers =
3838
functional: mark a test as functional
39-

setup.py

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,23 @@
11
#!/usr/bin/env python
22
import os
33
import sys
4-
import subprocess
5-
import datetime
6-
from setuptools import setup, find_packages
4+
from distutils import log
5+
from distutils.command.clean import clean as CleanCommand
6+
from distutils.dir_util import remove_tree
7+
8+
from setuptools import find_packages, setup
79
from setuptools.command.test import test as TestCommand
810

911
ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__)))
1012
sys.path.append(os.path.join(ROOT, 'src'))
11-
from concurrency import VERSION
12-
13-
NAME = 'django-concurrency'
14-
15-
16-
def get_version(version):
17-
"""Derives a PEP386-compliant version number from VERSION."""
18-
assert len(version) == 5
19-
assert version[3] in ('alpha', 'beta', 'rc', 'final')
20-
21-
parts = 2 if version[2] == 0 else 3
22-
main = '.'.join(str(x) for x in version[:parts])
23-
24-
sub = ''
25-
if version[3] == 'alpha' and version[4] == 0:
26-
git_changeset = get_git_changeset()
27-
if git_changeset:
28-
sub = '.a%s' % git_changeset
29-
30-
elif version[3] != 'final':
31-
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
32-
sub = mapping[version[3]]
33-
if version[4] > 0:
34-
sub += str(version[4])
35-
36-
return main + sub
3713

38-
39-
def get_git_changeset():
40-
"""Returns a numeric identifier of the latest git changeset.
41-
42-
The result is the UTC timestamp of the changeset in YYYYMMDDHHMMSS format.
43-
This value isn't guaranteed to be unique, but collisions are very unlikely,
44-
so it's sufficient for generating the development version numbers.
45-
"""
46-
repo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
47-
git_log = subprocess.Popen('git log --pretty=format:%ct --quiet -1 HEAD',
48-
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
49-
shell=True, cwd=repo_dir,
50-
universal_newlines=True)
51-
timestamp = git_log.communicate()[0]
52-
try:
53-
timestamp = datetime.datetime.utcfromtimestamp(int(timestamp))
54-
except ValueError:
55-
return None
56-
return timestamp.strftime('%Y%m%d%H%M%S')
57-
58-
59-
RELEASE = get_version(VERSION)
14+
app = __import__('concurrency')
6015
base_url = 'https://github.com/saxix/django-concurrency/'
61-
VERSIONMAP = {'final': (VERSION, 'Development Status :: 5 - Production/Stable'),
62-
'rc': (VERSION, 'Development Status :: 4 - Beta'),
63-
'beta': (VERSION, 'Development Status :: 4 - Beta'),
64-
'alpha': ('master', 'Development Status :: 3 - Alpha')}
65-
66-
download_tag, development_status = VERSIONMAP[VERSION[3]]
6716
install_requires = []
6817

6918

7019
class PyTest(TestCommand):
20+
7121
def finalize_options(self):
7222
TestCommand.finalize_options(self)
7323
self.test_args = ['tests']
@@ -82,9 +32,56 @@ def run_tests(self):
8232
sys.exit(errno)
8333

8434

35+
class Clean(CleanCommand):
36+
user_options = CleanCommand.user_options + [
37+
('build-coverage=', 'c',
38+
"build directory for coverage output (default: 'build.build-coverage')"),
39+
]
40+
41+
def initialize_options(self):
42+
self.build_coverage = None
43+
self.build_help = None
44+
CleanCommand.initialize_options(self)
45+
46+
def run(self):
47+
if self.all:
48+
for directory in (os.path.join(self.build_base, 'coverage'),
49+
os.path.join(self.build_base, 'help')):
50+
if os.path.exists(directory):
51+
remove_tree(directory, dry_run=self.dry_run)
52+
else:
53+
log.warn("'%s' does not exist -- can't clean it",
54+
directory)
55+
if self.build_coverage:
56+
remove_tree(self.build_coverage, dry_run=self.dry_run)
57+
if self.build_help:
58+
remove_tree(self.build_help, dry_run=self.dry_run)
59+
CleanCommand.run(self)
60+
61+
install_requires = ["django"]
62+
test_requires = ["django-webtest>=1.7.5",
63+
"mock>=1.0.1",
64+
"pytest-cache>=1.0",
65+
"pytest-cov>=1.6",
66+
"pytest-django>=2.8",
67+
"pytest-echo>=1.3",
68+
"pytest-pythonpath",
69+
"pytest>=2.8",
70+
"tox>=2.3",
71+
"WebTest>=2.0.11"]
72+
73+
dev_requires = ["autopep8",
74+
"coverage",
75+
"django_extensions",
76+
"flake8",
77+
"ipython",
78+
"pdbpp",
79+
"psycopg2",
80+
"sphinx"]
81+
8582
setup(
86-
name=NAME,
87-
version=RELEASE,
83+
name=app.NAME,
84+
version=app.get_version(),
8885
url='https://github.com/saxix/django-concurrency',
8986
author='Stefano Apostolico',
9087
author_email='[email protected]',
@@ -96,9 +93,12 @@ def run_tests(self):
9693
license='MIT License',
9794
keywords='django',
9895
install_requires=install_requires,
96+
tests_require=test_requires,
97+
extras_require={'test': test_requires,
98+
'dev': test_requires + dev_requires},
9999
cmdclass={'test': PyTest},
100100
classifiers=[
101-
development_status,
101+
'Development Status :: 5 - Production/Stable',
102102
'Environment :: Web Environment',
103103
'Intended Audience :: Developers',
104104
'License :: OSI Approved :: BSD License',

0 commit comments

Comments
 (0)