Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Install any dependencies first
self.install_deps(pb, src_dir, test=test, test_all=test_all, generator=generator, insecure=insecure)
# Setup cmake file
if pb.cmake:
target = os.path.join(src_dir, 'CMakeLists.txt')
if os.path.exists(target):
os.rename(target, os.path.join(src_dir, builder.cmake_original_file))
shutil.copyfile(pb.cmake, target)
# Configure and build
builder.configure(src_dir, defines=pb.define, generator=generator, install_prefix=install_dir, test=test, variant=pb.variant)
builder.build(variant=pb.variant)
# Run tests if enabled
if test or test_all: builder.test(variant=pb.variant)
# Install
builder.build(target='install', variant=pb.variant)
if util.USE_SYMLINKS: util.symlink_dir(install_dir, self.prefix)
else: util.copy_dir(install_dir, self.prefix)
self.write_parent(pb, track=track)
return "Successfully installed {}".format(pb.to_name())
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)