~ubuntu-branches/ubuntu/karmic/quodlibet/karmic

« back to all changes in this revision

Viewing changes to gdist/core.py

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2009-01-30 23:55:34 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20090130235534-l4e72ulw0vqfo17w
Tags: 2.0-1ubuntu1
* Merge from Debian experimental (LP: #276856), remaining Ubuntu changes:
  + debian/patches/40-use-music-profile.patch:
    - Use the "Music and Movies" pipeline per default.
* Refresh the above patch for new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2007 Joe Wreschnig
 
2
#
 
3
# This software and accompanying documentation, if any, may be freely
 
4
# used, distributed, and/or modified, in any form and for any purpose,
 
5
# as long as this notice is preserved. There is no warranty, either
 
6
# express or implied, for this software.
 
7
 
 
8
"""core support for gdist packages
 
9
 
 
10
This module exists to avoid circular imports within gdist.
 
11
"""
 
12
 
 
13
import os
 
14
 
 
15
from distutils.core import Command
 
16
 
 
17
class GCommand(Command):
 
18
    """An abstract base class for commands in gdist"""
 
19
 
 
20
    user_options = []
 
21
 
 
22
    def initialize_options(self):
 
23
        pass
 
24
 
 
25
    def finalize_options(self):
 
26
        self.po_directory = self.distribution.po_directory
 
27
 
 
28
    def capture(self, args):
 
29
        write, read = os.popen2(args, mode="r")
 
30
        return read.read()
 
31
 
 
32
    def check_po(self):
 
33
        """Exit if translation is needed and not available"""
 
34
        if not (self.po_directory and os.path.isdir(self.po_directory)):
 
35
            raise SystemExit("PO directory %r not found." % self.po_directory)
 
36
 
 
37
__all__ = ["GCommand"]