builtin_readlink.py 674 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/python
  2. # Copyright 2012 Steven Watanabe
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
  5. import BoostBuild
  6. import os
  7. import sys
  8. t = BoostBuild.Tester(pass_toolset=0)
  9. t.write("link-target", "")
  10. try:
  11. os.symlink("link-target", "link")
  12. except (AttributeError, OSError) as e:
  13. # Either OS does not support symlinks or not enough privilege
  14. print("XFAIL: %s" % e)
  15. t.cleanup()
  16. sys.exit()
  17. t.write("file.jam", """
  18. ECHO [ READLINK link ] ;
  19. EXIT [ READLINK link-target ] : 0 ;
  20. """)
  21. t.run_build_system(["-ffile.jam"], stdout="""link-target
  22. """)
  23. t.cleanup()