Beispiel #1
0
    def execute(self, pipedata):
        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)

            try:
                shellutil.copy(_in_license, _out_license)
            except:
                pass
        else:
            # In case no license_file in bakery.yaml fontbakery-build will
            #  search for supported licenses and copy first from list.
            #  See: CopyLicense.supported_licenses attribute
            for lic in self.supported_licenses:
                src = op.join(self.project_root, lic)
                dest = op.join(self.builddir, 'sources', lic)
                if os.path.exists(src):
                    shellutil.copy(src, dest)
                    pipedata['license_file'] = lic
                    break
        return pipedata
Beispiel #2
0
    def execute(self, pipedata):
        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)

            try:
                shellutil.copy(_in_license, _out_license)
            except:
                pass
        else:
            # In case no license_file in bakery.yaml fontbakery-build will
            #  search for supported licenses and copy first from list.
            #  See: CopyLicense.supported_licenses attribute
            for lic in self.supported_licenses:
                src = op.join(self.project_root, lic)
                dest = op.join(self.builddir, 'sources', lic)
                if os.path.exists(src):
                    shellutil.copy(src, dest)
                    pipedata['license_file'] = lic
                    break
        return pipedata
Beispiel #3
0
def copy_single_file(src, dest):
    """ Copies single filename from src directory to dest directory """
    if op.exists(src) and op.isfile(src):
        shellutil.copy(src, dest)
        return True
Beispiel #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)
Beispiel #5
0
def copy_single_file(src, dest):
    """ Copies single filename from src directory to dest directory """
    if op.exists(src) and op.isfile(src):
        shellutil.copy(src, dest)
        return True
Beispiel #6
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)