[Python-modules-commits] [python-deprecation] 01/06: Import python-deprecation_1.1.orig.tar.gz
Ondrej Koblizek
kobla-guest at moszumanska.debian.org
Tue Feb 6 12:09:59 UTC 2018
This is an automated email from the git hooks/post-receive script.
kobla-guest pushed a commit to branch master
in repository python-deprecation.
commit b1abab6d9ce908f21a014f80831c0927d3342234
Author: Ondřej Kobližek <ondrej.koblizek at firma.seznam.cz>
Date: Mon Feb 5 07:35:55 2018 +0100
Import python-deprecation_1.1.orig.tar.gz
---
.coveragerc | 3 ++
.gitignore | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++
.travis.yml | 16 +++++++++
deprecation.py | 13 ++++----
setup.py | 25 ++++++++-------
test-requirements.txt | 1 +
tox.ini | 1 +
7 files changed, 130 insertions(+), 18 deletions(-)
diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..c8550fe
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,3 @@
+[run]
+branch = True
+source = deprecation
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..72364f9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,89 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+.hypothesis/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# IPython Notebook
+.ipynb_checkpoints
+
+# pyenv
+.python-version
+
+# celery beat schedule file
+celerybeat-schedule
+
+# dotenv
+.env
+
+# virtualenv
+venv/
+ENV/
+
+# Spyder project settings
+.spyderproject
+
+# Rope project settings
+.ropeproject
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..773f66e
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,16 @@
+language: python
+python:
+ - "2.7"
+ - "3.4"
+ - "3.5"
+ - "3.6"
+ - "3.7-dev" # 3.7 development branch
+ - "pypy"
+ - "pypy3"
+# command to install dependencies
+install: "pip install -r test-requirements.txt"
+# command to run tests
+script: python -m unittest discover
+after_success:
+ - coverage run -m unittest discover
+ - codecov
diff --git a/deprecation.py b/deprecation.py
index 4a07e0f..28a21ee 100644
--- a/deprecation.py
+++ b/deprecation.py
@@ -9,11 +9,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
-from distutils import version
import functools
import warnings
+from packaging import version
+
__version__ = "1.0"
# This is mostly here so automodule docs are ordered more ideally.
@@ -128,13 +128,13 @@ def deprecated(deprecated_in=None, removed_in=None, current_version=None,
# StrictVersion won't take a None or a "", so make whatever goes to it
# is at least *something*.
if current_version:
- current_version = version.StrictVersion(current_version)
+ current_version = version.parse(current_version)
if (removed_in
- and current_version >= version.StrictVersion(removed_in)):
+ and current_version >= version.parse(removed_in)):
is_unsupported = True
elif (deprecated_in
- and current_version >= version.StrictVersion(deprecated_in)):
+ and current_version >= version.parse(deprecated_in)):
is_deprecated = True
else:
# If we can't actually calculate that we're in a period of
@@ -180,7 +180,8 @@ def deprecated(deprecated_in=None, removed_in=None, current_version=None,
the_warning = cls(function.__name__, deprecated_in,
removed_in, details)
- warnings.warn(the_warning)
+ warnings.warn(the_warning, category=DeprecationWarning,
+ stacklevel=2)
return function(*args, **kwargs)
return _inner
diff --git a/setup.py b/setup.py
index ea8feed..8b51ae9 100644
--- a/setup.py
+++ b/setup.py
@@ -14,20 +14,21 @@ setup(name="deprecation",
author_email=EMAIL,
maintainer=AUTHOR,
maintainer_email=EMAIL,
+ install_requires=["packaging"],
keywords=["deprecation"],
long_description=io.open("README.rst", encoding="utf-8").read(),
py_modules=["deprecation"],
classifiers=[
- "Development Status :: 5 - Production/Stable",
- "License :: OSI Approved :: Apache Software License",
- "Programming Language :: Python",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 2.7",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.4",
- "Programming Language :: Python :: 3.5",
- "Programming Language :: Python :: 3.6",
- "Programming Language :: Python :: Implementation :: CPython",
- "Programming Language :: Python :: Implementation :: PyPy",
- "Topic :: Software Development :: Libraries :: Python Modules"]
+ "Development Status :: 5 - Production/Stable",
+ "License :: OSI Approved :: Apache Software License",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 2",
+ "Programming Language :: Python :: 2.7",
+ "Programming Language :: Python :: 3",
+ "Programming Language :: Python :: 3.4",
+ "Programming Language :: Python :: 3.5",
+ "Programming Language :: Python :: 3.6",
+ "Programming Language :: Python :: Implementation :: CPython",
+ "Programming Language :: Python :: Implementation :: PyPy",
+ "Topic :: Software Development :: Libraries :: Python Modules"]
)
diff --git a/test-requirements.txt b/test-requirements.txt
index b292a77..e12bf36 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,4 +1,5 @@
codecov>=2.0
coverage>=4.3
flake8>=3.2
+packaging>=16.8
unittest2>=1.1
diff --git a/tox.ini b/tox.ini
index 1dab673..3458187 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,6 +8,7 @@ install_command = pip install -U {opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
setenv =
VIRTUAL_ENV={envdir}
+ PYTHONPATH={envdir}
commands = python -m unittest discover
[testenv:flake8]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-deprecation.git
More information about the Python-modules-commits
mailing list