yml2c
changeset 43 fb35b9db9ca1
parent 41 98a53c3282c3
child 50 963c1b542610
equal deleted inserted replaced
42:700f4d003349 43:fb35b9db9ca1
    12 from optparse import OptionParser
    12 from optparse import OptionParser
    13 
    13 
    14 from yml2.pyPEG import parse, u
    14 from yml2.pyPEG import parse, u
    15 from yml2 import ymlCStyle, comment, oldSyntax
    15 from yml2 import ymlCStyle, comment, oldSyntax
    16 import yml2.backend as backend
    16 import yml2.backend as backend
       
    17 
       
    18 YML_DEFAULT_PATH = [os.path.dirname(backend.__file__)]
    17 
    19 
    18 def printInfo(option, opt_str, value, parser):
    20 def printInfo(option, opt_str, value, parser):
    19     sys.stdout.write(__doc__)
    21     sys.stdout.write(__doc__)
    20     sys.exit(0)
    22     sys.exit(0)
    21 
    23 
    56 
    58 
    57 try:
    59 try:
    58     if options.includePathText:
    60     if options.includePathText:
    59         backend.includePath = options.includePathText.split(':')
    61         backend.includePath = options.includePathText.split(':')
    60 
    62 
    61     dirs = os.environ.get('YML_PATH', '.').split(':')
    63     dirs = os.environ.get('YML_PATH', '.').split(':') + YML_DEFAULT_PATH
    62     backend.includePath.extend(dirs)
    64     backend.includePath.extend(dirs)
    63 
    65 
    64     files = fileinput.input(args, mode="rU", openhook=fileinput.hook_encoded(options.encoding))
    66     files = fileinput.input(args, mode="rU", openhook=fileinput.hook_encoded(options.encoding))
    65 
    67 
    66     ymlC = ymlCStyle()
    68     ymlC = ymlCStyle()