Пример #1
0
    def migrate_results_trees(self, expected_results, confirmed_results):
        cwd = os.getcwd()
        expected_results = moresh.relative_path(expected_results, cwd)
        confirmed_results = moresh.relative_path(confirmed_results, cwd)
        
        # Files are listed in 'topdown' order.
        logging.debug("Migrating %s to %s"%(confirmed_results,expected_results))
        common_files, unique_to_expected, unique_to_confirmed =\
            moresh.compare_trees(expected_results, confirmed_results, ["\.svn"])

        # Overwritten results
        for expected_filepath, confirmed_filepath in common_files:
            mv_cmd = 'mv -f %s %s'%(confirmed_filepath, expected_filepath)
            logging.debug(mv_cmd)
            os.system(mv_cmd)
        
        # Old expected results to be removed
        for expected_filepath in unique_to_expected:
            logging.debug("recursive_remove %s --force"%expected_filepath)
            version_control.recursive_remove(expected_filepath, '--force')

        # New expected results to be added
        for confirmed_filepath in unique_to_confirmed:
            expected_filepath = confirmed_filepath.replace('.confirmed', '')
            assert not os.path.exists(expected_filepath)

            if os.path.isdir(confirmed_filepath) \
               and moresh.is_recursively_empty(confirmed_filepath):
                continue # Do not add empty directory to version control.
            
            rename_cmd = 'os.rename("%s", "%s")'%(confirmed_filepath, expected_filepath)
            logging.debug(rename_cmd)
            eval(rename_cmd)

            version_control.recursive_add(expected_filepath)
Пример #2
0
    def toString(self, expkey=None, short=False):
        s = '%s\n' % relative_path(self.expdir)
        if short and expkey is None:
            return s

        for key, value in self.getKey(expkey).iteritems():
            s += '    %s= %s\n' % (key.ljust(30), value)
        return s
Пример #3
0
 def toString(self, expkey=None, short=False):
     s = '%s\n' % relative_path(self.expdir)
     if short and expkey is None:
         return s
     
     for key, value in self.getKey(expkey).iteritems():
         s += '    %s= %s\n' % (key.ljust(30), value)
     return s
Пример #4
0
    def migrate_results_trees(self, expected_results, confirmed_results):
        cwd = os.getcwd()
        expected_results = moresh.relative_path(expected_results, cwd)
        confirmed_results = moresh.relative_path(confirmed_results, cwd)

        # Files are listed in 'topdown' order.
        logging.debug("Migrating %s to %s" %
                      (confirmed_results, expected_results))
        common_files, unique_to_expected, unique_to_confirmed =\
            moresh.compare_trees(expected_results, confirmed_results, ["\.svn"])

        # Overwritten results
        for expected_filepath, confirmed_filepath in common_files:
            mv_cmd = 'mv -f %s %s' % (confirmed_filepath, expected_filepath)
            logging.debug(mv_cmd)
            os.system(mv_cmd)

        # Old expected results to be removed
        for expected_filepath in unique_to_expected:
            logging.debug("recursive_remove %s --force" % expected_filepath)
            version_control.recursive_remove(expected_filepath, '--force')

        # New expected results to be added
        for confirmed_filepath in unique_to_confirmed:
            expected_filepath = confirmed_filepath.replace('.confirmed', '')
            assert not os.path.exists(expected_filepath)

            if os.path.isdir(confirmed_filepath) \
               and moresh.is_recursively_empty(confirmed_filepath):
                continue  # Do not add empty directory to version control.

            rename_cmd = 'os.rename("%s", "%s")' % (confirmed_filepath,
                                                    expected_filepath)
            logging.debug(rename_cmd)
            eval(rename_cmd)

            version_control.recursive_add(expected_filepath)
Пример #5
0
    def compile(self, publish_dirpath=""):
        succeeded = True
        if self.isCompilable():
            # Remove old compile log if any
            publish_target = os.path.join(
                publish_dirpath, os.path.basename(self.__log_file_path))
            if os.path.islink(publish_target) or os.path.isfile(
                    publish_target):
                os.remove(publish_target)
            assert not os.path.exists(publish_target)

            # Ensure compilation is needed
            if self.compilationSucceeded():
                logging.debug("Already successfully compiled %s" %
                              self.getInternalExecPath())
                succeeded = True

            elif self.__attempted_to_compile:
                logging.debug("Already attempted to compile %s" %
                              self.getInternalExecPath())
                succeeded = False

            # First compilation attempt
            else:
                #print "+++ SHORTCUT!!!", self.name
                #succeeded = True
                succeeded = self.__first_compilation_attempt()
                #print "+++ FIRST ATTEMPT", self.name, succeeded

            # Publish the compile log
            if succeeded and publish_dirpath:
                logging.debug("Publishing the compile log %s" %
                              self.__log_file_path)
                toolkit.symlink(self.__log_file_path,
                                moresh.relative_path(publish_target))

        # Account for dependencies
        #print "+++ Success", self.name, succeeded
        for dep in self.dependencies:
            succeeded = (succeeded and dep.compile(publish_dirpath))
            #print "+++ DEPcompile", succeeded

        return succeeded
Пример #6
0
    def compile(self, publish_dirpath=""):
        succeeded = True
        if self.isCompilable():
            # Remove old compile log if any        
            publish_target = os.path.join(publish_dirpath,
                                          os.path.basename(self.__log_file_path))
            if os.path.islink(publish_target) or os.path.isfile(publish_target):
                os.remove(publish_target)
            assert not os.path.exists(publish_target)
            
            # Ensure compilation is needed
            if self.compilationSucceeded():
                logging.debug("Already successfully compiled %s"%self.getInternalExecPath())
                succeeded = True
            
            elif self.__attempted_to_compile:
                logging.debug("Already attempted to compile %s"%self.getInternalExecPath())
                succeeded = False
            
            # First compilation attempt
            else:
                #print "+++ SHORTCUT!!!", self.name
                #succeeded = True 
                succeeded = self.__first_compilation_attempt()               
                #print "+++ FIRST ATTEMPT", self.name, succeeded
            
            # Publish the compile log
            if succeeded and publish_dirpath:
                logging.debug("Publishing the compile log %s"%self.__log_file_path)
                toolkit.symlink(self.__log_file_path,
                                moresh.relative_path(publish_target))

        # Account for dependencies
        #print "+++ Success", self.name, succeeded        
        for dep in self.dependencies:
            succeeded = (succeeded and dep.compile(publish_dirpath))        
            #print "+++ DEPcompile", succeeded
            
        return succeeded