Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _list_files(self, pkg=None, top=True):
if pkg is None:
return util.ls(self.get_package_directory(), os.path.isdir)
else:
p = self.parse_pkg_src(pkg)
ls = util.ls(self.get_deps_directory(p.to_fname()), os.path.isfile)
if top: return [p.to_fname()]+list(ls)
else: return ls
def size_command(prefix, n):
pkgs = len(list(util.ls(prefix.get_package_directory(), os.path.isdir)))
if pkgs != int(n):
raise util.BuildError("Not the correct number of items: {}".format(pkgs))
def _list_files(self, pkg=None, top=True):
if pkg is None:
return util.ls(self.get_package_directory(), os.path.isdir)
else:
p = self.parse_pkg_src(pkg)
ls = util.ls(self.get_deps_directory(p.to_fname()), os.path.isfile)
if top: return [p.to_fname()]+list(ls)
else: return ls
def link(self, pkg):
pkg = self.parse_pkg_src(pkg)
pkg_dir = self.get_package_directory(pkg.to_fname())
unlink_dir = self.get_unlink_directory(pkg.to_fname())
if os.path.exists(unlink_dir):
os.rename(unlink_dir, pkg_dir)
if util.USE_SYMLINKS: util.symlink_dir(os.path.join(pkg_dir, 'install'), self.prefix)
else: util.copy_dir(os.path.join(pkg_dir, 'install'), self.prefix)
# Relink dependencies
for dep in util.ls(self.get_unlink_directory(), os.path.isdir):
ls = util.ls(self.get_unlink_deps_directory(dep), os.path.isfile)
if pkg.to_fname() in ls: self.link(dep)
def link(self, pkg):
pkg = self.parse_pkg_src(pkg)
pkg_dir = self.get_package_directory(pkg.to_fname())
unlink_dir = self.get_unlink_directory(pkg.to_fname())
if os.path.exists(unlink_dir):
os.rename(unlink_dir, pkg_dir)
if util.USE_SYMLINKS: util.symlink_dir(os.path.join(pkg_dir, 'install'), self.prefix)
else: util.copy_dir(os.path.join(pkg_dir, 'install'), self.prefix)
# Relink dependencies
for dep in util.ls(self.get_unlink_directory(), os.path.isdir):
ls = util.ls(self.get_unlink_deps_directory(dep), os.path.isfile)
if pkg.to_fname() in ls: self.link(dep)