def test_fix_local_symlinks_with_relative_links(deployment_dir): # Runs shouldn't ruin the already relative symlinks. d = Deployment('testing') d.package_dir = deployment_dir local = os.path.join(deployment_dir, 'local') os.makedirs(local) symlink = os.path.join(local, 'symlink') os.symlink('../target', symlink) d.fix_local_symlinks() eq_(os.readlink(symlink), '../target')
def test_fix_local_symlinks(deployment_dir): d = Deployment('testing') d.package_dir = deployment_dir local = os.path.join(deployment_dir, 'local') os.makedirs(local) target = os.path.join(deployment_dir, 'sometarget') symlink = os.path.join(local, 'symlink') os.symlink(target, symlink) d.fix_local_symlinks() eq_(os.readlink(symlink), '../sometarget')
def test_fix_local_symlinks_with_relative_links(deployment_dir): # Runs shouldn't ruin the already relative symlinks. d = Deployment("testing") d.package_dir = deployment_dir local = os.path.join(deployment_dir, "local") os.makedirs(local) symlink = os.path.join(local, "symlink") os.symlink("../target", symlink) d.fix_local_symlinks() eq_(os.readlink(symlink), "../target")
def test_fix_local_symlinks(deployment_dir): d = Deployment("testing") d.package_dir = deployment_dir local = os.path.join(deployment_dir, "local") os.makedirs(local) target = os.path.join(deployment_dir, "sometarget") symlink = os.path.join(local, "symlink") os.symlink(target, symlink) d.fix_local_symlinks() eq_(os.readlink(symlink), "../sometarget")
def test_fix_local_symlinks_does_not_blow_up_on_missing_local(deployment_dir): d = Deployment('testing') d.package_dir = deployment_dir d.fix_local_symlinks()
pip_version="10.0.1", use_system_packages=args.use_system_packages, python=python_executable, extra_pip_arg=['-qq'], log_file=None, # TODO(pbovbel) Builtin venv (python3-venv) is not available on trusty. This flag can be re-enabled when # trusty support is dropped. # builtin_venv=args.python3, ) print('Generating virtualenv in {}'.format(deploy.package_dir)) deploy.create_virtualenv() print('Installing requirements') deploy.install_dependencies() print('Fixing virtualenv root to {}'.format(deploy.virtualenv_install_dir)) deploy.fix_activate_path() deploy.fix_shebangs() deploy.fix_local_symlinks() # Remove all .py[co] files since they embed absolute paths delete_bytecode(deploy.package_dir) local_dir = os.path.join(deploy.package_dir, 'local') if os.path.exists(local_dir): # Remove local folder shutil.rmtree(local_dir) sys.exit(0)