~dholbach/help-app/1426304

« back to all changes in this revision

Viewing changes to edit-here/translations.py

  • Committer: Daniel Holbach
  • Date: 2015-03-03 12:41:18 UTC
  • Revision ID: daniel.holbach@canonical.com-20150303124118-m8rht49r2ryczksp
add require() function to simplify code a bit

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
import subprocess
9
9
import sys
10
10
 
 
11
 
 
12
def require(package):
 
13
    print('Missing prerequisites. Please run: '
 
14
          '"sudo apt install %s"' % package)
 
15
    sys.exit(1)
 
16
 
11
17
try:
12
18
    import polib
13
19
except ImportError:
14
 
    print('Missing prerequisites. Please run: '
15
 
          '"sudo apt install python3-polib"')
16
 
    sys.exit(1)
 
20
    require('python3-polib')
17
21
 
18
22
from pelicanconf import PATH
19
23
 
42
46
            '-M', 'utf-8',
43
47
            ]
44
48
        if not shutil.which('po4a'):
45
 
            print('Missing prerequisites. Please run: "sudo apt install po4a"')
46
 
            sys.exit(1)
 
49
            require('po4a')
47
50
 
48
51
    def run(self, po4a_command, additional_args, with_output=False):
49
52
        args = copy.copy(self.default_args)