def get_source_dir(self): if self.rep_type == Repository.TYPE_GITHUB: return os.path.join(FileUtil.get_current_dir(), Constants.VENDOR_DIR, self.get_dir_name()) elif self.rep_type == Repository.TYPE_LOCAL: return os.path.join(self.rep_name, 'build') else: return ''
def get_source_dir(self): if self.rep_type == Constants.REPOSITORY_TYPE_GIT: return FileUtil.normalize_path( os.path.join(FileUtil.get_current_dir(), Constants.VENDOR_DIR, self.get_dir_name())) elif self.rep_type == Constants.REPOSITORY_TYPE_LOCAL: return FileUtil.normalize_path(os.path.join( self.rep_path, 'build')) elif self.rep_type == Constants.REPOSITORY_TYPE_ZIP: return FileUtil.normalize_path( os.path.join(FileUtil.get_current_dir(), Constants.VENDOR_DIR, self.get_dir_name())) elif self.rep_type == Constants.REPOSITORY_TYPE_TAR: return FileUtil.normalize_path( os.path.join(FileUtil.get_current_dir(), Constants.VENDOR_DIR, self.get_dir_name())) else: return ''
def prepare_from_process_data(self, process_data): if process_data: process_data.set_target_data( name=self.get_name(), temp_dir=self.repository.get_temp_dir(), vendor_dir=self.repository.get_vendor_dir(), source_dir=self.repository.get_source_dir(), build_dir=os.path.join(FileUtil.get_current_dir(), Constants.BUILD_DIR, self.get_name()), ) if self.repository: self.repository.prepare_from_process_data(process_data)
def test_temp_working_dir(self, d): os.chdir(d.path) repository = Repository.from_dict({ 'type': Constants.REPOSITORY_TYPE_TAR, 'path': 'http://ezored.com/downloads/dependency-sample.tar.gz', }) temp_working_dir = repository.get_temp_dir() self.assertEqual( temp_working_dir, os.path.join(FileUtil.get_current_dir(), Constants.TEMP_DIR, repository.get_temp_dir()) )
def test_git_temp_working_dir(self, d): os.chdir(d.path) repository = Repository.from_dict({ 'type': Constants.REPOSITORY_TYPE_GIT, 'path': 'https://github.com/ezored/dependency-sample.git', 'version': 't:1.0.0', }) temp_working_dir = repository.get_temp_dir() self.assertEqual( temp_working_dir, os.path.join(FileUtil.get_current_dir(), Constants.TEMP_DIR, repository.get_temp_dir()))
def test_github_temp_working_dir(self, d): os.chdir(d.path) repository = Repository.from_dict({ 'type': 'github', 'name': 'ezored/dependency-sample', 'version': 't:1.0.0', }) temp_working_dir = repository.get_temp_dir() self.assertEqual( temp_working_dir, os.path.join(FileUtil.get_current_dir(), Constants.TEMP_DIR, repository.get_dir_name()))
def reset(self): self.project_name = '' self.project_home_dir = FileUtil.get_current_dir() self.target_temp_dir = '' self.target_source_dir = '' self.target_vendor_dir = '' self.target_build_dir = '' self.target_name = '' self.dependency_temp_dir = '' self.dependency_source_dir = '' self.dependency_vendor_dir = '' self.dependency_build_dir = '' self.dependency_name = '' self.temp_dir = os.path.join(self.project_home_dir, Constants.TEMP_DIR) self.build_dir = os.path.join(self.project_home_dir, Constants.BUILD_DIR) self.vendor_dir = os.path.join(self.project_home_dir, Constants.VENDOR_DIR)