Skip to content

Commit 40d5194

Browse files
committed
correcting version logic
1 parent f3e2a31 commit 40d5194

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ install:
1818
script:
1919
- coverage run --source=pydf setup.py test
2020
- flake8 pydf/
21+
- if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then python setup.py check -rms; fi
2122
- python setup.py install
2223
- tests/check_file_permissions.py
2324
- python -c "import pydf; print(pydf.get_version())"
24-
- if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then python setup.py check -rms; fi
2525

2626
after_success:
2727
- ls -lha

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ Changelog
103103
- uprev wkhtmltopdf from **0.12.2 (beta)** to **0.12.4**.
104104
- code cleanup
105105

106+
0.21
107+
~~~~
108+
109+
- correct permissions on wkhtmltopdf binary.
110+
106111
.. |Build Status| image:: https://travis-ci.org/tutorcruncher/pydf.svg?branch=master
107112
:target: https://travis-ci.org/tutorcruncher/pydf
108113
.. |codecov.io| image:: https://codecov.io/github/tutorcruncher/pydf/coverage.svg?branch=master

pydf/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
from .wkhtmltopdf import * # noqa
2+
from .version import VERSION # noqa

pydf/version.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from distutils.version import StrictVersion
2+
3+
VERSION = StrictVersion('0.3.0')

pydf/wkhtmltopdf.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import os
22
import subprocess
33
from tempfile import NamedTemporaryFile
4-
5-
__version__ = '0.3'
4+
from .version import VERSION
65

76

87
def execute_wk(*args):
@@ -132,14 +131,12 @@ def get_version():
132131
133132
:return: version string
134133
"""
135-
v = 'pydf version: %s\n' % __version__
136134
try:
137135
wk_version = _string_execute('-V')
138136
except Exception as e:
139137
# we catch all errors here to make sure we get a version no matter what
140-
wk_version = 'Error: %s' % str(e)
141-
v += 'wkhtmltopdf version: %s' % wk_version
142-
return v
138+
wk_version = '%s: %s' % (e.__class__.__name__, e)
139+
return 'pydf version: %s\nwkhtmltopdf version: %s' % (VERSION, wk_version)
143140

144141

145142
def get_help():

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
from setuptools import setup
33
from setuptools.command.install import install
4+
from pydf.version import VERSION
45

56
description = 'PDF generation in python using wkhtmltopdf suitable for heroku'
67
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -19,7 +20,7 @@ def run(self):
1920
setup(
2021
name='python-pdf',
2122
cmdclass={'install': OverrideInstall},
22-
version='0.23',
23+
version=str(VERSION),
2324
description=description,
2425
long_description=long_description,
2526
author='Samuel Colvin',

0 commit comments

Comments
 (0)