# Path: pyoptix/utils.py
# def glob_recursive(path, pattern):
#     matches = []
#     for dirpath, dirnames, filenames in os.walk(path):
#         for filename in fnmatch.filter(filenames, pattern):
#             matches.append(os.path.join(dirpath, filename))
#     return matches
# 
# def find_sub_path(sub_path, search_paths):
#     import os.path
# 
#     for search_path in search_paths:
#         path = os.path.join(search_path, sub_path)
#         if os.path.exists(path):
#             return path
# 
#     raise ValueError('Sub-path not found in searched paths: {0}'.format(sub_path))


import logging
import re
import os
import sys
import shlex
import fnmatch
from stat import S_IRUSR, S_IWUSR, S_IRGRP, S_IWGRP, S_IROTH, S_IWOTH, S_IXUSR, S_IXGRP, S_IXOTH
from subprocess import check_call, CalledProcessError
from pyoptix.utils import glob_recursive, find_sub_path
    from configparser import ConfigParser
    from ConfigParser import SafeConfigParser as ConfigParser
    def get_abs_program_path(cls, file_path):
        if os.path.exists(file_path):
            return file_path
        else:
            abs_path = find_sub_path(file_path, cls._program_directories)
            if os.path.exists(abs_path):
                return abs_path
            else:
                raise ValueError('File not found')


try:
    config_path = os.path.join(os.path.dirname(sys.executable), 'pyoptix.conf')

    if not os.path.exists(config_path):
        config_path = '/etc/pyoptix.conf'

    config = ConfigParser()
    config.read(config_path)
    nvcc_path = config.get('pyoptix', 'nvcc_path')
    compile_args = config.get('pyoptix', 'compile_args')

    if nvcc_path is not None:
        Compiler.nvcc_path = nvcc_path
    if compile_args is not None:
        Compiler._compile_args = [arg for arg in compile_args.split(os.pathsep)]

except Exception as e:
    logger.warning("Could not load pyoptix.conf")


# Path: pyoptix/utils.py
# def glob_recursive(path, pattern):
#     matches = []
#     for dirpath, dirnames, filenames in os.walk(path):
#         for filename in fnmatch.filter(filenames, pattern):
#             matches.append(os.path.join(dirpath, filename))
#     return matches
# 
# def find_sub_path(sub_path, search_paths):
#     import os.path
# 
#     for search_path in search_paths:
#         path = os.path.join(search_path, sub_path)
#         if os.path.exists(path):
#             return path
# 
#     raise ValueError('Sub-path not found in searched paths: {0}'.format(sub_path))


# Path: pyoptix/compiler.py
import logging
import re
import os
import sys
import shlex
import fnmatch
from stat import S_IRUSR, S_IWUSR, S_IRGRP, S_IWGRP, S_IROTH, S_IWOTH, S_IXUSR, S_IXGRP, S_IXOTH
from subprocess import check_call, CalledProcessError
from pyoptix.utils import glob_recursive, find_sub_path
    from configparser import ConfigParser
    from ConfigParser import SafeConfigParser as ConfigParser

    def get_abs_program_path(cls, file_path):
        if os.path.exists(file_path):
            return file_path
        else:
            abs_path = find_sub_path(file_path, cls._program_directories)
            if os.path.exists(abs_path):
                return abs_path
            else:
                raise ValueError('File not found')


try:
    config_path = os.path.join(os.path.dirname(sys.executable), 'pyoptix.conf')

    if not os.path.exists(config_path):
        config_path = '/etc/pyoptix.conf'

    config = ConfigParser()
    config.read(config_path)
    nvcc_path = config.get('pyoptix', 'nvcc_path')
    compile_args = config.get('pyoptix', 'compile_args')

    if nvcc_path is not None:
        Compiler.nvcc_path = nvcc_path
    if compile_args is not None:
        Compiler._compile_args = [arg for arg in compile_args.split(os.pathsep)]

except Exception as e:
    logger.warning("Could not load pyoptix.conf")


if not os.path.exists(Compiler.output_path):