def clean(self): if util.USE_SYMLINKS: util.delete_dir(self.get_private_path()) util.rm_symlink_dir(self.prefix) util.rm_empty_dirs(self.prefix) else: for p in self.list(): self.remove(p) util.delete_dir(self.get_private_path())
def configure(self, src_dir=None, build_dir=None, options=None): if self.need_reconfig(build_dir, options): delete_dir(build_dir) if not os.path.isdir(build_dir): os.mkdir(build_dir) args = [self.cmake, '-DCMAKE_INSTALL_PREFIX=' + self.install_root] for o, v in options.items(): if o == 'define': args += ['-D' + d + '=' + dv for d, dv in v.items()] elif o == 'generator': args += ['-G', v] args.append(src_dir) cmd(args, cwd=build_dir)
def unlink(self, pkg, delete=False): pkg = self.parse_pkg_src(pkg) pkg_dir = self.get_package_directory(pkg.to_fname()) unlink_dir = self.get_unlink_directory(pkg.to_fname()) self.log("Unlink:", pkg_dir) if os.path.exists(pkg_dir): if util.MERGE_INSTALLS: if util.USE_SYMLINKS: util.rm_symlink_from(os.path.join(pkg_dir, 'install'), self.prefix) else: util.rm_dup_dir(os.path.join(pkg_dir, 'install'), self.prefix, remove_both=False) util.rm_empty_dirs(self.prefix) if delete: util.delete_dir(pkg_dir) else: util.mkdir(self.get_unlink_directory()) os.rename(pkg_dir, unlink_dir)
def fetch(self): fn = os.path.join(self.config.arch_root(), self.archive) if os.path.isfile(fn): click.echo('Using cached archive {0} '.format(fn)) else: try: click.echo('Fetching file {0} ...'.format(self.url)) urlretrieve(self.url, fn) click.echo('Ok.') except ConnectionError as e: click.echo(str(e)) sys.exit(2) temp_dir = os.path.abspath('temp') re_extract = False exists = os.path.isdir(temp_dir) if not exists or re_extract: click.echo("Extracting archive {0} ...".format(fn)) if exists: util.delete_dir(temp_dir) os.mkdir(temp_dir) util.extract_ar(archive=fn, dst=temp_dir) else: click.echo("Extracting skipped: using temporary") dirs = [ o for o in os.listdir(temp_dir) if os.path.isdir(os.path.join(temp_dir, o)) ] if len(dirs) != 1: raise Exception('Wrong dir count') temp_src_dir = os.path.join(temp_dir, dirs[0]) self.choose_builder(temp_src_dir) src_dir = self.src_dir() util.delete_dir(src_dir) os.rename(temp_src_dir, src_dir) util.delete_dir(temp_dir) self.stage = FETCHED self.save() click.echo("Sources placed to {0}".format(src_dir))
def fetch(self, url, fname, hash=None, copy=False, insecure=False, pkg=None): self.prefix.log("fetch:", url) if insecure: url = url.replace('https', 'http') if pkg is not None: f = os.path.join(self.arch_dir, pkg['archive']) if not os.path.isfile(f): f = util.retrieve_url(url, self.arch_dir, copy=copy, insecure=insecure, hash=hash) if os.path.isfile(f): click.echo("Extracting archive {0} ...".format(f)) temp_dir = os.path.abspath('temp') util.delete_dir(temp_dir) os.mkdir(temp_dir) util.extract_ar(archive=f, dst=temp_dir) dirs = [ o for o in os.listdir(temp_dir) if os.path.isdir(os.path.join(temp_dir, o)) ] if len(dirs) != 1: raise Exception('wrong count') util.delete_dir(os.path.join(self.src_dir, fname)) os.rename(os.path.join(temp_dir, dirs[0]), os.path.join(self.src_dir, fname)) util.delete_dir(temp_dir) return os.path.join(self.src_dir, fname) return next(util.get_dirs( self.top_dir)) # list of dirs dirs, found in top_dir
def clean(self): util.delete_dir(self.get_private_path()) util.rm_symlink_dir(self.prefix) util.rm_empty_dirs(self.prefix)
def clean(self): click.echo('Removing build and source directories') util.delete_dir(self.build_dir()) util.delete_dir(self.src_dir()) self.stage = CLEAN
def clean(self): util.delete_dir(self.get_private_path()) util.rm_symlink_dir(self.prefix) util.rm_empty_dirs(self.prefix)