# These settings for the Ply parse tables are placed in their own file so that 
# they can be easily replaced if this package is used in a larger package that 
# needs different settings.

import os

PREFIX = 'docgen'
LEXTAB = 'lextab'
PARSETAB = 'parsetab'
SUFFIX = str(os.getuid())
DIRECTORY = '/tmp'

def join(*components):
    return '_'.join([each for each in components if each])

class TabFiles(object):
    def __init__(self, filepath):
        root = os.path.splitext(filepath)[0]
        name = os.path.split(root)[1]
        self.lextab = join(PREFIX, name, LEXTAB, SUFFIX)
        self.parsetab = join(PREFIX, name, PARSETAB, SUFFIX)
        self.directory = DIRECTORY
