diff options
author | Julien Danjou <julien@danjou.info> | 2014-08-28 14:52:46 +0200 |
---|---|---|
committer | Julien Danjou <julien@danjou.info> | 2014-09-10 15:19:39 +0200 |
commit | 5832d05c65bbbd932fb60844c1afca89e591b292 (patch) | |
tree | d494e19bb920c6b8093ec1a037a3f17fcb097c1c | |
parent | fe31f0c68ac034df9fe0f4fc1ddb704e2e6f87b5 (diff) | |
download | lockfile-5832d05c65bbbd932fb60844c1afca89e591b292.tar.gz |
Add .gitreview, tox targets and use pbr
Change-Id: I9360c3ea4354f296039e11b09cb4e3b0771f87b4
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | .gitreview | 4 | ||||
-rw-r--r-- | MANIFEST | 19 | ||||
-rw-r--r-- | MANIFEST.in | 4 | ||||
-rw-r--r-- | doc/glossary.rst | 15 | ||||
-rw-r--r-- | doc/index.rst | 22 | ||||
-rw-r--r-- | doc/source/Makefile (renamed from doc/Makefile) | 0 | ||||
-rw-r--r-- | doc/source/conf.py (renamed from doc/conf.py) | 4 | ||||
-rw-r--r-- | doc/source/index.rst (renamed from doc/lockfile.rst) | 31 | ||||
-rw-r--r-- | setup.cfg | 33 | ||||
-rw-r--r-- | setup.py | 56 | ||||
-rw-r--r-- | test-requirements.txt | 2 | ||||
-rw-r--r-- | tox.ini | 18 |
13 files changed, 105 insertions, 108 deletions
@@ -2,3 +2,8 @@ dist .tox *.pyc *~ +doc/build +AUTHORS +ChangeLog +*.egg +pylockfile.egg-info
\ No newline at end of file diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..d6e7fce --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/pylockfile.git diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index d302eef..0000000 --- a/MANIFEST +++ /dev/null @@ -1,19 +0,0 @@ -2.4.diff -ACKS -LICENSE -MANIFEST -README -RELEASE-NOTES -setup.py -doc/Makefile -doc/conf.py -doc/glossary.rst -doc/index.rst -doc/lockfile.rst -lockfile/__init__.py -lockfile/linklockfile.py -lockfile/mkdirlockfile.py -lockfile/pidlockfile.py -lockfile/sqlitelockfile.py -test/compliancetest.py -test/test_lockfile.py diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 31903eb..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -include README RELEASE-NOTES LICENSE MANIFEST setup.py ACKS 2.4.diff -recursive-include doc *.rst conf.py Makefile -recursive-include test *.py -recursive-include lockfile *.py diff --git a/doc/glossary.rst b/doc/glossary.rst deleted file mode 100644 index 9401d48..0000000 --- a/doc/glossary.rst +++ /dev/null @@ -1,15 +0,0 @@ -.. _glossary: - -******** -Glossary -******** - -.. if you add new entries, keep the alphabetical sorting! - -.. glossary:: - - context manager - An object which controls the environment seen in a :keyword:`with` - statement by defining :meth:`__enter__` and :meth:`__exit__` methods. - See :pep:`343`. - diff --git a/doc/index.rst b/doc/index.rst deleted file mode 100644 index 9718a68..0000000 --- a/doc/index.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. lockfile documentation master file, created by sphinx-quickstart on Sat Sep 13 17:54:17 2008. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to lockfile's documentation! -==================================== - -Contents: - -.. toctree:: - :maxdepth: 2 - - lockfile.rst - glossary.rst - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/doc/Makefile b/doc/source/Makefile index 1b1e8d2..1b1e8d2 100644 --- a/doc/Makefile +++ b/doc/source/Makefile diff --git a/doc/conf.py b/doc/source/conf.py index 64678e9..623edcb 100644 --- a/doc/conf.py +++ b/doc/source/conf.py @@ -32,7 +32,7 @@ templates_path = ['.templates'] source_suffix = '.rst' # The master toctree document. -master_doc = 'lockfile' +master_doc = 'index' # General substitutions. project = 'lockfile' @@ -104,7 +104,7 @@ html_style = 'default.css' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['.static'] +#html_static_path = ['.static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/doc/lockfile.rst b/doc/source/index.rst index f20d8aa..2ed17dc 100644 --- a/doc/lockfile.rst +++ b/doc/source/index.rst @@ -20,14 +20,14 @@ .. note:: - The implementation uses the :keyword:`with` statement, both in the - tests and in the main code, so will only work out-of-the-box with Python - 2.5 or later. However, the use of the :keyword:`with` statement is - minimal, so if you apply the patch in the included 2.4.diff file you can - use it with Python 2.4. It's possible that it will work in Python 2.3 - with that patch applied as well, though the doctest code relies on APIs - new in 2.4, so will have to be rewritten somewhat to allow testing on - 2.3. As they say, patches welcome. ``;-)`` + The implementation uses the `with` statement, both in the tests and in the + main code, so will only work out-of-the-box with Python 2.5 or later. + However, the use of the `with` statement is minimal, so if you apply the + patch in the included 2.4.diff file you can use it with Python 2.4. It's + possible that it will work in Python 2.3 with that patch applied as well, + though the doctest code relies on APIs new in 2.4, so will have to be + rewritten somewhat to allow testing on 2.3. As they say, patches welcome. + ``;-)`` The :mod:`lockfile` package exports a :class:`LockFile` class which provides a simple API for locking files. Unlike the Windows :func:`msvcrt.locking` @@ -173,14 +173,13 @@ and HOSTNAME-THREADID-PID will be an empty file within that directory. LockFile Objects ---------------- -:class:`LockFile` objects support the :term:`context manager` protocol used -by the statement:`with` statement. The timeout option is not supported when -used in this fashion. While support for timeouts could be implemented, -there is no support for handling the eventual :exc:`Timeout` exceptions -raised by the :func:`__enter__` method, so you would have to protect the -:keyword:`with` statement with a :keyword:`try` statement. The resulting -construct would not be any simpler than just using a :keyword:`try` -statement in the first place. +:class:`LockFile` objects support the `context manager` protocol used by the +statement:`with` statement. The timeout option is not supported when used in +this fashion. While support for timeouts could be implemented, there is no +support for handling the eventual :exc:`Timeout` exceptions raised by the +:func:`__enter__` method, so you would have to protect the `with` statement with +a `try` statement. The resulting construct would not be any simpler than just +using a `try` statement in the first place. :class:`LockFile` has the following user-visible methods: diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..b05506f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,33 @@ +[metadata] +name = pylockfile +summary = Platform-independent file locking module +description-file = + README +author = OpenStack +author-email = openstack-dev@lists.openstack.org +home-page = http://launchpad.net/pylockfile +classifier = + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: POSIX :: Linux + Operating System :: MacOS + Operating System :: Microsoft :: Windows :: Windows NT/2000 + Operating System :: POSIX + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 2.6 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.3 + Topic :: Software Development :: Libraries :: Python Modules + +[files] +packages = lockfile + +[pbr] +warnerrors = true + +[build_sphinx] +source-dir = doc/source +build-dir = doc/build +all_files = 1 @@ -1,32 +1,30 @@ #!/usr/bin/env python +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. -V = "0.9.1" +# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT +import setuptools -from distutils.core import setup -setup(name='lockfile', - author='Skip Montanaro', - author_email='skip@pobox.com', - url='http://code.google.com/p/pylockfile/', - download_url=('http://code.google.com/p/pylockfile/downloads/' - 'detail?name=lockfile-%s.tar.gz' % V), - version=V, - description="Platform-independent file locking module", - long_description=open("README").read(), - packages=['lockfile'], - license='MIT License', - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: MacOS', - 'Operating System :: Microsoft :: Windows :: Windows NT/2000', - 'Operating System :: POSIX', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2.4', - 'Programming Language :: Python :: 2.5', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.0', - 'Topic :: Software Development :: Libraries :: Python Modules', - ] - ) +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr'], + pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..2e087ff --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +nose +sphinx>=1.1.2,!=1.2.0,<1.3 @@ -1,6 +1,22 @@ # content of: tox.ini , put in same dir as setup.py [tox] envlist = py26,py27,py32,py33 + [testenv] -deps = nose +deps = -r{toxinidir}/test-requirements.txt commands=nosetests + +[testenv:venv] +commands = {posargs} + +[testenv:pep8] +deps = flake8 +commands = flake8 + +[testenv:docs] +commands = python setup.py build_sphinx + +[flake8] +ignore = E121,E123,E128,E221,E226,E261,E265,E301,E302,E713,F401,F841,W291,W293,W391 +exclude=.venv,.git,.tox,dist,doc +show-source = True |