# Path: starterpyth/core.py
# def load_module(modulename):
#     parents = modulename.split('.')
#     path = sys.path
#     module = None
#     abs_module_name = ''
#     cwd = os.getcwd()
#     for module_name in parents:
#         (file_, pathname, description) = imp.find_module(module_name, path)
#         name_to_import = abs_module_name + module_name
#         if name_to_import in sys.modules:
#             module = sys.modules[name_to_import]
#         else:
#             module = imp.load_module(name_to_import, file_, pathname, description)
#         path = [os.path.dirname(module.__file__)]
#         abs_module_name += module_name + '.'
#     os.chdir(cwd)
#     return module
# 
# Path: starterpyth/log.py
# RED = '31'
# GREEN = '32'
# YELLOW = '33'
# BLUE = '34'
# MAGENTA = '35'
# CYAN = '36'
# WHITE = '37'
# def display(text, color=None, bold=False, newline=True):
# def print_tb(error, msg=None):
# 
# Path: starterpyth/translation.py
# def __find(domain, locale_module, localedir='locale', languages=None):
# def translation(domain, locale_module, localedir='locale', languages=None, class_=None, fallback=False):
# __TRANS = translation(parent_package, parent_package, fallback=True)


from setuptools import find_packages
from six import u
from starterpyth.core import load_module
from starterpyth.log import yellow, red, green
from distutils.core import Command
from starterpyth.translation import gettext as _
import os
    import polib

    def __init__(self, dist=None):
        Command.__init__(self, dist=dist)
        self.language = 'xx_XX'
        self.dest = None

    def initialize_options(self):
        self.language = 'xx_XX'
        self.dest = None

    def finalize_options(self):
        pass

    def run(self):
        if polib is None:
            print(red(_('package polib is required.')))
            return 1
        module_names = find_packages()
        dst_rel_path = 'locale' if self.dest is None else self.dest
        # group by top-level packages and compute their directories:
        top_levels_modules = {}
        for module_name in module_names:
            top_level = module_name.partition('.')[0]
            if top_level not in top_levels_modules:
                locale_dir = os.path.join(os.path.dirname(load_module(top_level).__file__), dst_rel_path)
                top_levels_modules[top_level] = locale_dir

        for module_name, locale_dir in top_levels_modules.items():
            po_filename = os.path.join(locale_dir, self.language, 'LC_MESSAGES', '%s.po' % module_name)
            if not os.path.isfile(po_filename):

# Path: starterpyth/core.py
# def load_module(modulename):
#     parents = modulename.split('.')
#     path = sys.path
#     module = None
#     abs_module_name = ''
#     cwd = os.getcwd()
#     for module_name in parents:
#         (file_, pathname, description) = imp.find_module(module_name, path)
#         name_to_import = abs_module_name + module_name
#         if name_to_import in sys.modules:
#             module = sys.modules[name_to_import]
#         else:
#             module = imp.load_module(name_to_import, file_, pathname, description)
#         path = [os.path.dirname(module.__file__)]
#         abs_module_name += module_name + '.'
#     os.chdir(cwd)
#     return module
# 
# Path: starterpyth/log.py
# RED = '31'
# GREEN = '32'
# YELLOW = '33'
# BLUE = '34'
# MAGENTA = '35'
# CYAN = '36'
# WHITE = '37'
# def display(text, color=None, bold=False, newline=True):
# def print_tb(error, msg=None):
# 
# Path: starterpyth/translation.py
# def __find(domain, locale_module, localedir='locale', languages=None):
# def translation(domain, locale_module, localedir='locale', languages=None, class_=None, fallback=False):
# __TRANS = translation(parent_package, parent_package, fallback=True)


# Path: starterpyth/commands/pseudo_l10n.py
from setuptools import find_packages
from six import u
from starterpyth.core import load_module
from starterpyth.log import yellow, red, green
from distutils.core import Command
from starterpyth.translation import gettext as _
import os
    import polib


    def __init__(self, dist=None):
        Command.__init__(self, dist=dist)
        self.language = 'xx_XX'
        self.dest = None

    def initialize_options(self):
        self.language = 'xx_XX'
        self.dest = None

    def finalize_options(self):
        pass

    def run(self):
        if polib is None:
            print(red(_('package polib is required.')))
            return 1
        module_names = find_packages()
        dst_rel_path = 'locale' if self.dest is None else self.dest
        # group by top-level packages and compute their directories:
        top_levels_modules = {}
        for module_name in module_names:
            top_level = module_name.partition('.')[0]
            if top_level not in top_levels_modules:
                locale_dir = os.path.join(os.path.dirname(load_module(top_level).__file__), dst_rel_path)
                top_levels_modules[top_level] = locale_dir

        for module_name, locale_dir in top_levels_modules.items():
            po_filename = os.path.join(locale_dir, self.language, 'LC_MESSAGES', '%s.po' % module_name)
            if not os.path.isfile(po_filename):

                print(yellow(_('Missing file: %(filename)s. Please run the makemessages -l xx_XX command first.')