def version_packages(self): # exit if we don't have packages if self._packages is None: return if self.version and 'hardlink' == self.link_type: for pkg in self._packages: source_file = os.path.join(self.package_dir, pkg) target_file = os.path.join(self.version_package_dir, pkg) util.hardlink(source_file, target_file)
def _download_local_packages(self): packages = [] try: packages = self._validate_packages(self.local_dir, sorted(os.listdir(self.local_dir))) self._callback('repo_init', len(packages), True) for _file in packages: if 'hardlink' == self.link_type: status = util.hardlink(os.path.join(self.local_dir, _file), os.path.join(self.package_dir, _file)) if status: size = os.path.getsize(os.path.join(self.local_dir, _file)) self._callback('link_local_pkg', _file, size) else: self._callback('pkg_exists', _file) else: self._callback('pkg_exists', _file) self._packages = packages self._callback('repo_complete') except (KeyboardInterrupt, SystemExit): pass except Exception as e: self._callback('repo_error', str(e)) raise PackageDownloadError(str(e))