~ubuntu-branches/debian/sid/djvusmooth/sid

« back to all changes in this revision

Viewing changes to lib/dependencies.py

  • Committer: Package Import Robot
  • Author(s): Daniel Stender
  • Date: 2015-09-15 15:34:11 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20150915153411-zlz201vxr4wk5d3p
Tags: 0.2.16-1
* New upstream release (Closes: #799017).
* deb/control:
  + added dh-python to build deps.
  + put python-djvu and python-wxgtk3.0 also into build-deps (needed by the
    tests).
  + dropped Depends: against python-xdg (Closes: #793364).
* deb/copyright: updated.
* deb/watch: watch pypi.debian.net.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# encoding=UTF-8
2
2
 
3
 
# Copyright © 2008-2014 Jakub Wilk <jwilk@jwilk.net>
4
 
#
5
 
# This package is free software; you can redistribute it and/or modify
6
 
# it under the terms of the GNU General Public License as published by
7
 
# the Free Software Foundation; version 2 dated June, 1991.
8
 
#
9
 
# This package is distributed in the hope that it will be useful, but
10
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
 
# General Public License for more details.
 
3
# Copyright © 2008-2015 Jakub Wilk <jwilk@jwilk.net>
 
4
#
 
5
# This file is part of djvusmooth.
 
6
#
 
7
# djvusmooth is free software; you can redistribute it and/or modify it
 
8
# under the terms of the GNU General Public License version 2 as published
 
9
# by the Free Software Foundation.
 
10
#
 
11
# djvusmooth is distributed in the hope that it will be useful, but WITHOUT
 
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 
14
# more details.
13
15
 
14
16
'''
15
17
Checks for djvusmooth dependencies.
16
18
'''
17
19
 
18
 
DDJVU_API_MIN_VERSION = 26
19
 
PYTHON_DJVULIBRE_MIN_VERSION = (0, 1, 4)
20
 
 
21
20
djvulibre_path = None
22
21
 
23
22
def _check_signals():
39
38
    else:
40
39
        djvulibre_path = set_dll_search_path()
41
40
    try:
42
 
        from djvu.decode import __version__ as djvu_decode_version
43
 
    except ImportError, ex:
44
 
        raise ImportError('%s; perhaps python-djvulibre is not installed' % (ex,))
45
 
    python_djvu_decode_version, ddjvu_api_version = djvu_decode_version.split('/')
46
 
    if int(ddjvu_api_version) < DDJVU_API_MIN_VERSION:
47
 
        raise ImportError('DjVuLibre with DDJVU API >= %d is required' % DDJVU_API_MIN_VERSION)
48
 
    python_djvu_decode_version = map(int, python_djvu_decode_version.split('.'))
49
 
    if tuple(python_djvu_decode_version) < PYTHON_DJVULIBRE_MIN_VERSION:
50
 
        raise ImportError('python-djvulibre >= %s is required' % ('.'.join(map(str, PYTHON_DJVULIBRE_MIN_VERSION))))
 
41
        import djvu.decode
 
42
    except ImportError as exc:
 
43
        raise ImportError('{exc}; perhaps python-djvulibre is not installed'.format(exc=exc))
 
44
    del djvu  # quieten pyflakes
51
45
 
52
46
def _check_wx():
53
47
    try:
54
48
        import wxversion
55
 
    except ImportError, ex:
56
 
        raise ImportError('%s; perhaps wxPython is not installed' % (ex,))
 
49
    except ImportError as exc:
 
50
        raise ImportError('{exc}; perhaps wxPython is not installed'.format(exc=exc))
57
51
    for ver in ['2.8-unicode', '3.0']:
58
52
        try:
59
53
            wxversion.select(ver, optionsRequired=True)
65
59
        raise ImportError('wxPython 3.0 or 2.8 in Unicode mode is required')
66
60
 
67
61
_check_signals()
68
 
del _check_signals
69
 
try:
70
 
    _check_djvu()
71
 
finally:
72
 
    del _check_djvu
73
 
try:
74
 
    _check_wx()
75
 
finally:
76
 
    del _check_wx
 
62
_check_djvu()
 
63
_check_wx()
77
64
 
78
 
# vim:ts=4 sw=4 et
 
65
# vim:ts=4 sts=4 sw=4 et