예제 #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__