~townsend/libertine/configure-freeze

« back to all changes in this revision

Viewing changes to python/libertine/Libertine.py

  • Committer: Tarmac
  • Author(s): Chris Townsend
  • Date: 2017-01-17 16:48:55 UTC
  • mfrom: (373.1.1 libertine.which-binary)
  • Revision ID: tarmac-20170117164855-s724ytaf8wqxbmvm
Add function to check if a binary exists in via the container instead of checking if the path exists via the rootfs.

Approved by Larry Price, Libertine CI Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
                
113
113
        return language
114
114
 
 
115
    def _binary_exists(self, binary):
 
116
        return self.run_in_container("bash -c \"which {} &> /dev/null\"".format(binary)) == 0
 
117
 
 
118
    def setup_window_manager(self, enable_toolbars=False):
 
119
        if self._binary_exists('matchbox-window-manager'):
 
120
            if enable_toolbars:
 
121
                return ['matchbox-window-manager']
 
122
 
 
123
            return ['matchbox-window-manager', '-use_titlebar', 'no']
 
124
        else:
 
125
            return ['compiz']
 
126
            
 
127
 
115
128
    def check_language_support(self):
116
 
        if self.run_in_container("bash -c \"which check-language-support &> /dev/null\"") != 0:
 
129
        if not self._binary_exists('check-language-support'):
117
130
            self.install_package('language-selector-common', update_cache=False)
118
131
 
119
132
        self.run_in_container("bash -c \"{} install $(check-language-support -l {})\"".format(_apt_command_prefix(), self.language))
264
277
        :param archive: The configuration command to run.
265
278
        :param public_key_file: file containing the public key used to sign this archive
266
279
        """
267
 
        if not os.path.exists(os.path.join(self.root_path, 'usr', 'bin', 'add-apt-repository')):
 
280
        if not self._binary_exists('add-apt-repository'):
268
281
            self.install_package("software-properties-common")
269
282
        if 'https://' in archive and not os.path.exists(os.path.join(self.root_path, 'usr', 'lib', 'apt', 'methods', 'https')):
270
283
            self.install_package("apt-transport-https")