def dohtml(*sourceFiles, **kw): """inserts the files in the list of files into /usr/share/doc/PACKAGE/html""" """ example call: pisitools.dohtml("doc/doxygen/html/*")""" destDir = kw.get("destDir", get.srcNAME()) destionationDirectory = join_path(get.installDIR(), get.docDIR(), destDir, "html") if not can_access_directory(destionationDirectory): makedirs(destionationDirectory) allowed_extensions = [".png", ".gif", ".html", ".htm", ".jpg", ".css", ".js"] disallowed_directories = ["CVS", ".git", ".svn", ".hg"] for sourceFile in sourceFiles: sourceFileGlob = glob.glob(sourceFile) if len(sourceFileGlob) == 0: raise FileError(_('No file matched pattern "%s"') % sourceFile) for source in sourceFileGlob: if os.path.isfile(source) and os.path.splitext(source)[1] in allowed_extensions: system('install -m0644 "%s" %s' % (source, destionationDirectory)) if os.path.isdir(source) and os.path.basename(source) not in disallowed_directories: eraser = os.path.split(source)[0] for root, dirs, files in os.walk(source): newRoot = remove_prefix(eraser, root) for sourcename in files: if os.path.splitext(sourcename)[1] in allowed_extensions: makedirs(join_path(destionationDirectory, newRoot)) system( "install -m0644 %s %s" % (join_path(root, sourcename), join_path(destionationDirectory, newRoot, sourcename)) )
def dohtml(*sourceFiles): '''inserts the files in the list of files into /usr/share/doc/PACKAGE/html''' ''' example call: pisitools.dohtml("doc/doxygen/html/*")''' destionationDirectory = join_path(get.installDIR(), 'usr/share/doc', get.srcNAME(), 'html') if not can_access_directory(destionationDirectory): makedirs(destionationDirectory) allowed_extensions = ['.png', '.gif', '.html', '.htm', '.jpg', '.css', '.js'] disallowed_directories = ['CVS'] for sourceFile in sourceFiles: sourceFileGlob = glob.glob(sourceFile) if len(sourceFileGlob) == 0: raise FileError(_("No file matched pattern \"%s\"") % sourceFile) for source in sourceFileGlob: if os.path.isfile(source) and os.path.splitext(source)[1] in allowed_extensions: system('install -m0644 "%s" %s' % (source, destionationDirectory)) if os.path.isdir(source) and os.path.basename(source) not in disallowed_directories: eraser = os.path.split(source)[0] for root, dirs, files in os.walk(source): newRoot = remove_prefix(eraser, root) for sourcename in files: if os.path.splitext(sourcename)[1] in allowed_extensions: makedirs(join_path(destionationDirectory, newRoot)) system('install -m0644 %s %s' % (join_path(root, sourcename), join_path(destionationDirectory, newRoot, sourcename)))
def dohtml(*sourceFiles): '''inserts the files in the list of files into /usr/share/doc/PACKAGE/html''' ''' example call: pisitools.dohtml("doc/doxygen/html/*")''' destionationDirectory = join_path(get.installDIR(), 'usr/share/doc', get.srcTAG(), 'html') if not can_access_directory(destionationDirectory): makedirs(destionationDirectory) allowed_extensions = [ '.png', '.gif', '.html', '.htm', '.jpg', '.css', '.js' ] disallowed_directories = ['CVS'] for sourceFile in sourceFiles: for source in glob.glob(sourceFile): if os.path.isfile(source) and os.path.splitext( source)[1] in allowed_extensions: system('install -m0644 "%s" %s' % (source, destionationDirectory)) if os.path.isdir(source) and os.path.basename( source) not in disallowed_directories: eraser = os.path.split(source)[0] for root, dirs, files in os.walk(source): newRoot = remove_prefix(eraser, root) for sourcename in files: if os.path.splitext( sourcename)[1] in allowed_extensions: makedirs(join_path(destionationDirectory, newRoot)) system('install -m0644 %s %s' % (join_path(root, sourcename), join_path(destionationDirectory, newRoot, sourcename)))
def dohtml(*sourceFiles, **kw): '''inserts the files in the list of files into /usr/share/doc/PACKAGE/html''' ''' example call: pisitools.dohtml("doc/doxygen/html/*")''' destDir = kw.get("destDir", get.srcNAME()) destionationDirectory = join_path(get.installDIR(), get.docDIR(), destDir, 'html') if not can_access_directory(destionationDirectory): makedirs(destionationDirectory) allowed_extensions = ['.png', '.gif', '.html', '.htm', '.jpg', '.css', '.js'] disallowed_directories = ['CVS', '.git', '.svn', '.hg'] for sourceFile in sourceFiles: sourceFileGlob = glob.glob(sourceFile) if len(sourceFileGlob) == 0: raise FileError(_("No file matched pattern \"%s\"") % sourceFile) for source in sourceFileGlob: if os.path.isfile(source) and os.path.splitext(source)[1] in allowed_extensions: system('install -m0644 "%s" %s' % (source, destionationDirectory)) if os.path.isdir(source) and os.path.basename(source) not in disallowed_directories: eraser = os.path.split(source)[0] for root, dirs, files in os.walk(source): newRoot = remove_prefix(eraser, root) for sourcename in files: if os.path.splitext(sourcename)[1] in allowed_extensions: makedirs(join_path(destionationDirectory, newRoot)) system('install -m0644 %s %s' % (join_path(root, sourcename), join_path(destionationDirectory, newRoot, sourcename)))
def installLib(src='*.jar', dest='/usr/share/java'): '''install compilation output that is mix of the utility classes as in jars or meta/data files to specified locations. src: Source file pattern to be installed dest: Destination dir where the source files to be installed ''' classpath = [] destination = util.join_path(get.installDIR(), dest) sources = glob(src) # If no source matched, then no need to create destination dir if not sources: raise InstallError(_('No any file/directory matched ' 'to regex expression "%s".' % src)) if not os.access(destination, os.F_OK): os.makedirs(destination) for source in sources: if os.path.isfile(source): try: copy(source, destination) except IOError: raise InstallError(_('Installing file "%s" ' 'failed.' % source)) if source.endswith('.jar'): classpath.append(util.join_path('/', dest, source.split('/')[-1])) elif os.path.isdir(source): target = util.join_path(destination, source.split('/')[-1]) try: copytree(source, target) except IOError: raise InstallError(_('Installing directory "%s" ' 'failed.' % source)) for root, dirs, files in os.walk(target): for f in files: if f.endswith('.jar'): # Exclude sandbox dir from jar path jar = util.remove_prefix(get.installDIR(), util.join_path(root, f)) classpath.append(jar) if classpath: _generate_classpath_file(classpath)
def strip_debug_action(filepath, fileinfo, install_dir, ag): excludelist = [] if not ag.has_key('NoStrip') else ag['NoStrip'] outputpath = util.join_path(os.path.dirname(install_dir), ctx.const.debug_dir_suffix, ctx.const.debug_files_suffix, util.remove_prefix(install_dir, filepath)) # real path in .pisi package p = '/' + util.removepathprefix(install_dir, filepath) strip = True for exclude in excludelist: if p.startswith(exclude): strip = False if strip: if util.strip_file(filepath, fileinfo, outputpath): ctx.ui.debug("%s [%s]" % (p, "stripped"))