Example #1
0
    def execute(self, pipedata, prefix=""):
        self.stdout_pipe.write('Copy license file', prefix='### %s ' % prefix)
        if pipedata.get('license_file', None):
            # Set _in license file name
            license_file_in_full_path = pipedata['license_file']
            license_file_in = license_file_in_full_path.split('/')[-1]
            # List posible OFL and Apache filesnames
            list_of_ofl_filenames = ['Open Font License.markdown', 'OFL.txt',
                                     'OFL.md']
            listOfApacheFilenames = ['APACHE.txt', 'LICENSE']
            # Canonicalize _out license file name
            if license_file_in in list_of_ofl_filenames:
                license_file_out = 'OFL.txt'
            elif license_file_in in listOfApacheFilenames:
                license_file_out = 'LICENSE.txt'
            else:
                license_file_out = license_file_in
            # Copy license file
            _in_license = op.join(self.project_root, license_file_in_full_path)
            _out_license = op.join(self.builddir, license_file_out)

            shellutil.copy(_in_license, _out_license, log=self.stdout_pipe)
        else:
            self.stdout_pipe.write('License file not copied\n',
                                   prefix='Error: ')
        return pipedata
Example #2
0
 def copy(self, destdir):
     import glob
     super(TTXFontSource, self).copy(destdir)
     rootpath = op.dirname(self.source_path)
     fontname = op.basename(self.source_path)
     for f in glob.glob(op.join(rootpath, '%s.*.ttx' % fontname[:-4])):
         fontpath = op.join(rootpath, f)
         shutil.copy(fontpath, op.join(destdir), log=self.stdout_pipe)
Example #3
0
    def copy(self, destdir):
        """ Copy source file to destination directory.

            File can be renamed if family name and style different
            to original filename. See naming recommendation:
            http://forum.fontlab.com/index.php?topic=313.0 """
        destpath = op.join(destdir, self.get_file_name())

        if op.isdir(self.source_path):
            shutil.copytree(self.source_path, destpath,
                            log=self.stdout_pipe)
        else:
            shutil.copy(self.source_path, destpath,
                        log=self.stdout_pipe)
Example #4
0
def copy_single_file(src, dest, log):
    """ Copies single filename from src directory to dest directory """
    if op.exists(src) and op.isfile(src):
        shutil.copy(src, dest, log=log)