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

Up version to 3.1.dev0 #736

Merged
merged 8 commits into from Oct 21, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -30,6 +30,7 @@ addons:
- aspell-en

install:
- pip install 'setuptools>=36'
- pip install tox
- pip install 'coverage<4.0'
- pip install codecov
Expand Down
34 changes: 20 additions & 14 deletions markdown/__init__.py
Expand Up @@ -23,36 +23,42 @@
from __future__ import absolute_import
from __future__ import unicode_literals
from .core import Markdown, markdown, markdownFromFile
from pkg_resources.extern import packaging

# For backward compatibility as some extensions expect it...
from .extensions import Extension # noqa

__all__ = ['Markdown', 'markdown', 'markdownFromFile']

# version_info should conform to PEP 386
# (major, minor, micro, alpha/beta/rc/final, #)
# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
# version must conform to PEP 440
# https://www.python.org/dev/peps/pep-0440/

# __version_info__ format:
# (major, minor, patch, dev/alpha/beta/rc/final, #)
# (1, 1, 2, 'dev', 0) => "1.1.2.dev0"
# (1, 1, 2, 'alpha', 1) => "1.1.2a1"
# (1, 2, 0, 'beta', 2) => "1.2b2"
__version_info__ = (3, 0, 1, 'final', 0)
# (1, 2, 0, 'rc', 4) => "1.2rc4"
# (1, 2, 0, 'final', 0) => "1.2"
__version_info__ = (3, 1, 0, 'dev', 0)


def _get_version(): # pragma: no cover
" Returns a PEP 386-compliant version number from version_info. "
" Returns a PEP 440-compliant version number from version_info. "
assert len(__version_info__) == 5
assert __version_info__[3] in ('alpha', 'beta', 'rc', 'final')
assert __version_info__[3] in ('dev', 'alpha', 'beta', 'rc', 'final')

parts = 2 if __version_info__[2] == 0 else 3
main = '.'.join(map(str, __version_info__[:parts]))
v = '.'.join(map(str, __version_info__[:parts]))

sub = ''
if __version_info__[3] == 'alpha' and __version_info__[4] == 0:
# TODO: maybe append some sort of git info here??
sub = '.dev'
if __version_info__[3] == 'dev':
v += '.dev' + str(__version_info__[4])
elif __version_info__[3] != 'final':
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
sub = mapping[__version_info__[3]] + str(__version_info__[4])
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'rc'}
v += mapping[__version_info__[3]] + str(__version_info__[4])

return str(main + sub)
# Ensure version is valid and normalized
return str(packaging.version.Version(v))


__version__ = _get_version()
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
@@ -0,0 +1,4 @@
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools>=36", "wheel"]
build-backend = "setuptools.build_meta"
7 changes: 3 additions & 4 deletions setup.py
Expand Up @@ -28,15 +28,13 @@

# Get development Status for classifiers
dev_status_map = {
'dev': '2 - Pre-Alpha',
'alpha': '3 - Alpha',
'beta': '4 - Beta',
'rc': '4 - Beta',
'final': '5 - Production/Stable'
}
if __version_info__[3] == 'alpha' and __version_info__[4] == 0:
DEVSTATUS = '2 - Pre-Alpha'
else:
DEVSTATUS = dev_status_map[__version_info__[3]]
DEVSTATUS = dev_status_map[__version_info__[3]]

# The command line script name. Currently set to "markdown_py" so as not to
# conflict with the perl implimentation (which uses "markdown").
Expand Down Expand Up @@ -79,6 +77,7 @@
license='BSD License',
packages=['markdown', 'markdown.extensions'],
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
install_requires=['setuptools >= 36'],
entry_points={
'console_scripts': [
'%s = markdown.__main__:run' % SCRIPT_NAME,
Expand Down
7 changes: 6 additions & 1 deletion tox.ini
@@ -1,8 +1,13 @@
[tox]
envlist = py27, py34, py35, py36, py37, pypy, pypy3, flake8, checkspelling
requires = setuptools>=36
isolated_build = True

[testenv]
deps = -rtest-requirements.txt
deps =
coverage<4.0
pyyaml
pytidylib
commands = coverage run --source=markdown -m unittest discover {toxinidir}/tests
coverage report --show-missing

Expand Down