Ejemplo n.º 1
0
    def make_working_dir(self):
        """Makes a working directory under global build dir"""

        working_dir = os.path.expanduser("%s/temp/%s" % (
            self.global_config["build_directory"], 
            self.package_config["package"]
        ))

        if os.path.exists(working_dir):
            if not self.global_config['assume_yes']:
                result = get_user_input(
                    'Suitcase Warning: %s will be deleted. Are you sure?' \
                        % working_dir, ['yes','no'], 'yes',
                )
                
                if result == 'no':
                    sys.exit(1)
                    
            run_command("rm -rf %s" % working_dir)

        if DEBUG:
            print "MAKING: " + working_dir
            
        try:    
            os.makedirs(working_dir)
        except OSError, error:
            raise SuitcasePackagingError(error)
Ejemplo n.º 2
0
 def test_raw_input2(self):
     """Test getting user input with default"""
     suitcase.utils.raw_input = self.raw_input_mock_enter
     answer = get_user_input('Is this awesome or what?', ["y", "n"], "n")
     self.assert_equal(answer, 'n')
Ejemplo n.º 3
0
 def test_raw_input(self):
     """Check getting user input"""
     suitcase.utils.raw_input = self.raw_input_mock_n
     answer = get_user_input('Is this awesome or what?', ["y", "n"])
     self.assert_equal(answer, 'n')