dir_exists.py 569 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env python
  2. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. """Writes True if the argument is a directory."""
  6. import os.path
  7. import sys
  8. def main():
  9. sys.stdout.write(_is_dir(sys.argv[1]))
  10. return 0
  11. def _is_dir(dir_name):
  12. return str(os.path.isdir(dir_name))
  13. def DoMain(args):
  14. """Hook to be called from gyp without starting a separate python
  15. interpreter."""
  16. return _is_dir(args[0])
  17. if __name__ == '__main__':
  18. sys.exit(main())