def execute(self, pipedata): task = self.bakery.logging_task('Copy license file') if self.bakery.forcerun: return 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, log=self.bakery.log) self.bakery.logging_task_done(task) except: self.bakery.logging_task_done(task, failed=True) raise else: self.bakery.logging_err('License file not copied') return pipedata
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, log=self.bakery.logger) except: raise return pipedata
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)
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)
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)
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)
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, log=self.bakery.logger) except: raise 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, lic) if os.path.exists(src): shellutil.copy(src, dest, log=self.bakery.logger) pipedata['license_file'] = lic break return pipedata
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, log=self.bakery.logger) except: raise 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, lic) if os.path.exists(src): shellutil.copy(src, dest, log=self.bakery.logger) pipedata['license_file'] = lic break return pipedata
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)
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)