webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Functions | Variables
devtools.antglob Namespace Reference

Classes

class  AntPatternToRETest
 

Functions

def ant_pattern_to_re (ant_pattern)
 
def glob (dir_path, includes=' **/*', excludes=default_excludes, entry_type=FILE, prune_dirs=prune_dirs, max_depth=25)
 
def test_matching (self)
 def test_conversion( self ): self.assertEqual( '^somepath$', ant_pattern_to_re( 'somepath' ).pattern ) More...
 

Variables

string prune_dirs = '.git .bzr .hg .svn _MTN _darcs CVS SCCS '
 
string default_excludes
 exclude_pats = prune_pats + '*~ #*# . More...
 
int DIR = 1
 
int FILE = 2
 
int DIR_LINK = 4
 
int FILE_LINK = 8
 
int LINKS = DIR_LINK | FILE_LINK
 
int ALL_NO_LINK = DIR | FILE
 
int ALL = DIR | FILE | LINKS
 
 next_pos = match.end()
 print 'Converting', ant_pattern More...
 
 is_dir = os.path.isdir( full_path )
 print 'Testing:', full_path, More...
 
 included = apply_filter( full_path, include_filter )
 print '===> marked for recursion', More...
 
 rejected = apply_filter( full_path, exclude_filter )
 
 link = os.path.islink( full_path )
 print '=> not included or rejected' More...
 
 is_file = os.path.isfile( full_path )
 
int entry_type = is_file and FILE_LINK or DIR_LINK
 print '=> unknown entry type' More...
 

Function Documentation

◆ ant_pattern_to_re()

def devtools.antglob.ant_pattern_to_re (   ant_pattern)
Generates a regular expression from the ant pattern.
Matching convention:
**/a: match 'a', 'dir/a', 'dir1/dir2/a'
a/**/b: match 'a/b', 'a/c/b', 'a/d/c/b'
*.py: match 'script.py' but not 'a/script.py'

◆ glob()

def devtools.antglob.glob (   dir_path,
  includes = '**/*',
  excludes = default_excludes,
  entry_type = FILE,
  prune_dirs = prune_dirs,
  max_depth = 25 
)

◆ test_matching()

def devtools.antglob.test_matching (   self)

def test_conversion( self ): self.assertEqual( '^somepath$', ant_pattern_to_re( 'somepath' ).pattern )

Variable Documentation

◆ ALL

int devtools.antglob.ALL = DIR | FILE | LINKS

◆ ALL_NO_LINK

int devtools.antglob.ALL_NO_LINK = DIR | FILE

◆ default_excludes

string devtools.antglob.default_excludes
Initial value:
1 = '''
2 **/*~
3 **/#*#
4 **/.#*
5 **/%*%
6 **/._*
7 **/CVS
8 **/CVS/**
9 **/.cvsignore
10 **/SCCS
11 **/SCCS/**
12 **/vssver.scc
13 **/.svn
14 **/.svn/**
15 **/.git
16 **/.git/**
17 **/.gitignore
18 **/.bzr
19 **/.bzr/**
20 **/.hg
21 **/.hg/**
22 **/_MTN
23 **/_MTN/**
24 **/_darcs
25 **/_darcs/**
26 **/.DS_Store '''

exclude_pats = prune_pats + '*~ #*# .

#* %*% ._* .gitignore .cvsignore vssver.scc .DS_Store'.split()

◆ DIR

int devtools.antglob.DIR = 1

◆ DIR_LINK

int devtools.antglob.DIR_LINK = 4

◆ entry_type

int devtools.antglob.entry_type = is_file and FILE_LINK or DIR_LINK

print '=> unknown entry type'

◆ FILE

int devtools.antglob.FILE = 2

◆ FILE_LINK

int devtools.antglob.FILE_LINK = 8

◆ included

devtools.antglob.included = apply_filter( full_path, include_filter )

print '===> marked for recursion',

◆ is_dir

devtools.antglob.is_dir = os.path.isdir( full_path )

print 'Testing:', full_path,

◆ is_file

devtools.antglob.is_file = os.path.isfile( full_path )

◆ link

devtools.antglob.link = os.path.islink( full_path )

print '=> not included or rejected'

◆ LINKS

int devtools.antglob.LINKS = DIR_LINK | FILE_LINK

◆ next_pos

devtools.antglob.next_pos = match.end()

print 'Converting', ant_pattern

print 'Matched', match.group() print match.start(0), next_pos

◆ prune_dirs

string devtools.antglob.prune_dirs = '.git .bzr .hg .svn _MTN _darcs CVS SCCS '

◆ rejected

devtools.antglob.rejected = apply_filter( full_path, exclude_filter )