コード例 #1
0
ファイル: base.py プロジェクト: zyfra/ebonite
    def _write_sources(self, target_dir):
        """
        Writes sources to dir
        :param target_dir: target directory to write sources
        """
        for name, content in self.provider.get_sources().items():
            logger.debug('Putting model source "%s" to distribution...', name)
            path = os.path.join(target_dir, name)
            os.makedirs(os.path.dirname(path), exist_ok=True)
            with open(path,
                      'w' if isinstance(content, str) else 'wb',
                      encoding='utf8') as src:
                src.write(content)

        pip_ebonite = ebonite_from_pip()
        if pip_ebonite is False:
            logger.debug(
                'Putting Ebonite sources to distribution as local installation is employed...'
            )
            main_module_path = get_lib_path('.')
            shutil.copytree(main_module_path,
                            os.path.join(target_dir, 'ebonite'))
        elif isinstance(pip_ebonite, str):
            logger.debug(
                'Putting Ebonite wheel to distribution as wheel installation is employed...'
            )
            shutil.copy(pip_ebonite, target_dir)
コード例 #2
0
ファイル: local.py プロジェクト: zyfra/ebonite
 def __init__(self, path: str = None):
     self.path = os.path.abspath(path or get_lib_path('local_storage'))
コード例 #3
0
ファイル: test_fs.py プロジェクト: rubaha96/ebonite
def test_module_path():
    assert fs.get_lib_path(path.join('utils', 'fs.py')) == fs.__file__