# Path: progSpec.py
# def cdlog(lvl, mesg):
#     global MaxLogLevelToShow
#     global lastLogMesgs
#     global highestLvl
#     highestLvl=lvl
#     resizeLogArray(lvl)
#     lastLogMesgs[lvl]=mesg
#     for i in range(highestLvl+1, len(lastLogMesgs)):
#         lastLogMesgs[i]=''
#     if(lvl<=MaxLogLevelToShow):
#         if(lvl==0): print('')
#         printAtLvl(lvl, mesg, '|    ')
# 
# def cdErr(mesg):
#     global lastLogMesgs
#     global highestLvl
#     highestLvl+=1
#     lastLogMesgs[highestLvl]="\n\nError: "+mesg
#     exit(1)


from inspect import getsourcefile
from os.path import abspath
from pprint import pprint
from progSpec import cdlog, cdErr
from pyparsing import ParseResults
import os
import re
import codeDogParser
import progSpec

In codeDog the problem is solved by telling
the compiler about features and needs instead of about the libraries.
The compiler then chooses which libraries to link from the listed program needs.

There are two kinds of need that the programmer can specify in dog files:
We'll call them 'features' and 'components'. Features are functionality that
must be added to codeDog in order for your program to work (GUI-toolkit,
Unicode, Math-kit, Networking.) Features often correspond to actual libraries.
Components are files that describe libraries that may be specific to particular
platforms. GTK3, XCODE, etc. Both features and components are "needs"
that are specified with tags.
'''

def getTagsFromLibFiles():
    """simple getter for module level variable"""
    return tagsFromLibFiles

def collectLibFilenamesFromFolder(folderPath):
    for filename in os.listdir(folderPath):
        if filename.endswith("Lib.dog"):
            libPaths.append(os.path.join(folderPath, filename))
        elif filename.endswith("Lib.dog.proxy"):
            line = open(os.path.join(folderPath, filename)).readline()
            line=line.strip()
            baseName = os.path.basename(line)
            #print("baseName: {}".format(baseName))
            if (filename.strip('.proxy') == baseName):
                libPaths.append(os.path.realpath(line))
            else:

# Path: progSpec.py
# def cdlog(lvl, mesg):
#     global MaxLogLevelToShow
#     global lastLogMesgs
#     global highestLvl
#     highestLvl=lvl
#     resizeLogArray(lvl)
#     lastLogMesgs[lvl]=mesg
#     for i in range(highestLvl+1, len(lastLogMesgs)):
#         lastLogMesgs[i]=''
#     if(lvl<=MaxLogLevelToShow):
#         if(lvl==0): print('')
#         printAtLvl(lvl, mesg, '|    ')
# 
# def cdErr(mesg):
#     global lastLogMesgs
#     global highestLvl
#     highestLvl+=1
#     lastLogMesgs[highestLvl]="\n\nError: "+mesg
#     exit(1)


# Path: libraryMngr.py
from inspect import getsourcefile
from os.path import abspath
from pprint import pprint
from progSpec import cdlog, cdErr
from pyparsing import ParseResults
import os
import re
import codeDogParser
import progSpec


In codeDog the problem is solved by telling
the compiler about features and needs instead of about the libraries.
The compiler then chooses which libraries to link from the listed program needs.

There are two kinds of need that the programmer can specify in dog files:
We'll call them 'features' and 'components'. Features are functionality that
must be added to codeDog in order for your program to work (GUI-toolkit,
Unicode, Math-kit, Networking.) Features often correspond to actual libraries.
Components are files that describe libraries that may be specific to particular
platforms. GTK3, XCODE, etc. Both features and components are "needs"
that are specified with tags.
'''

def getTagsFromLibFiles():
    """simple getter for module level variable"""
    return tagsFromLibFiles

def collectLibFilenamesFromFolder(folderPath):
    for filename in os.listdir(folderPath):
        if filename.endswith("Lib.dog"):
            libPaths.append(os.path.join(folderPath, filename))
        elif filename.endswith("Lib.dog.proxy"):
            line = open(os.path.join(folderPath, filename)).readline()
            line=line.strip()
            baseName = os.path.basename(line)
            #print("baseName: {}".format(baseName))
            if (filename.strip('.proxy') == baseName):
                libPaths.append(os.path.realpath(line))
            else:

                cdErr("File name "+filename+" does not match path name.")